public void UseSpell(Team[] teams, long currentTime) { if (spells.Count != 0) { ConsoleOutput.Add(currentTime, string.Format("Hero {0} using Spell", Name)); spells[0].Action(teams, this); } }
private void WriteLine(string line) { Caliburn.Micro.Execute.OnUIThread(() => { ConsoleOutput.Add(line); if (IsShown) { StatusText = ConsoleOutput.Count + " lines"; NotifyOfPropertyChange(() => ConsoleOutput); NotifyOfPropertyChange(() => StatusText); } }); }
private void SetCurrentOutput(string currentOutput) { ConsoleOutput.Clear(); var outputGroup = outputGroups.Find(x => x.ApplicationName.ToLower() == currentOutput.ToLower()); if (outputGroup != null) { foreach (var line in outputGroup.Lines) { ConsoleOutput.Add(line); } } }
public void AutoAttack(Team[] teams, long currentTime) { Hero target; if (!stats.isDead) { target = SelectTarget(teams); int realDamage = (stats.Damage - target.stats.Def); realDamage = realDamage >= 1 ? realDamage : 1; ConsoleOutput.Add(currentTime, (string.Format("Hero {0} deals {1} {3} to Hero {2}", Name, realDamage > 0 ? realDamage : -realDamage, target.Name, realDamage > 0 ? "damage" : "heal"))); target.Damage(realDamage, DamageType.Physical); stats.AddSP(0.2); } stats.Attack(currentTime); }
/// <summary> /// /// </summary> public bool Start() { var isRunning = false; var userSettings = UserSettingsRepositoryHelper.GetUserSettings(); var shareTime = int.Parse(userSettings.ShareTime); var maxConcurrentMiners = int.Parse(userSettings.MaxConcurrentMiners); if (InstanceStore.WorkerStore.HasCapacity(maxConcurrentMiners)) { InstanceStore.Logger.LogInfo($"Starting '{SelectedConfiguration.Crypto.CryptoName}' miner..."); ConsoleOutput.Add($"Starting '{SelectedConfiguration.Crypto.CryptoName}' miner..."); StartMiner(maxConcurrentMiners); UIIsUnlocked = false; PlayIcon = "Stop"; StartTooltip = "Stop miner"; if (SupportJobsAreScheduled == false) { if (shareTime == 60) { InstanceStore.Logger.LogInfo($"Starting '{DefaultConfiguration.Crypto.CryptoName}' support miner..."); StartSupportMiner(); } else if (shareTime > 0) { InstanceStore.Logger.LogInfo($"Scheduling '{DefaultConfiguration.Crypto.CryptoName}' support miner..."); ScheduleSupportMinerAndStart(shareTime); } } _sw.Start(); _dt.Start(); isRunning = true; } else { SendMessage(new MainViewModelMessage() { Purpose = MessagePurpose.OPEN_SNACKBAR, Payload = string.Format("Limit of {0} running miners reached", maxConcurrentMiners) }); } return(isRunning); }
private async Task UpdateStandardOutput() { var line = await myStreamReader.ReadLineAsync(); var checkLine = "(Cmd)"; if (line.Contains(checkLine)) { line = line.Replace(checkLine, $"{checkLine} {ConsoleInput.Trim()}\n"); ConsoleInput = string.Empty; } if (line != null) { ConsoleOutput.Add(line); } await UpdateStandardOutput(); }
public void Start() { co = new ConsoleOutput(); timer = new Stopwatch(); timer.Start(); PrintStatus(); while (!(teams[0].isDead() || teams[1].isDead())) //пока обе команды живы { //обходим всех живых героев for (int i = 0; i < 2; i++) { for (int j = 0; j < teams[i].AliveHeroes.Count; j++) { teams[i].AliveHeroes[j].UpdateStatus(teams, timer.ElapsedMilliseconds); teams[(n + 1) % 2].UpdateStatus(); PrintStatus(); n++; } } Spells(); co.Print(); } ConsoleOutput.Add(timer.ElapsedMilliseconds, teams[0].isDead() ? "Right win" : "Left win"); if (!teams[0].isDead()) { for (int i = 0; i < teams[0].Count; i++) { teams[0][i].stats.AddExp(50); } ConsoleOutput.Add(timer.ElapsedMilliseconds, "You Win"); } else { ConsoleOutput.Add(timer.ElapsedMilliseconds, "you Lose"); } }
public void RunConsoleInput() { if (_parent.bot == null) { //MainWindow.wssv.WebSocketServices.Broadcast($"{{\"msg\":\"disconnected\",\"data\":[]}}"); Machina.Logger.Error("Not connected to any Robot..."); } else { string[] instructions = Machina.Utilities.Parsing.SplitStatements(ConsoleInput, ';', "//"); foreach (var instruction in instructions) { ConsoleOutput.Add(new LoggerArgs(null, Machina.LogLevel.INFO, $"Issuing \"{instruction}\"")); _parent.ExecuteStatement(instruction); } _parent.ConsoleScroller.ScrollToBottom(); } this._parent.InputBlock.Text = String.Empty; }
private void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) { DispatchService.Invoke(() => ConsoleOutput.Add(string.Format("{0}: {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), e.Error.Message))); } else if (e.Cancelled) { DispatchService.Invoke(() => ConsoleOutput.Add(string.Format("{0} {1}:", DateTime.Now.ToString(CultureInfo.InvariantCulture), _cancelMessage))); } else { ProgressPercentage = 0; DispatchService.Invoke(() => ConsoleOutput.Add(string.Format("{0}: Numar total de fisiere importate {1}.", DateTime.Now.ToString(CultureInfo.InvariantCulture), e.Result))); } StartEnabled = !_worker.IsBusy; CancelEnabled = _worker.IsBusy; timer.Stop(); }
/// <summary> /// /// </summary> public void Stop() { InstanceStore.Logger.LogInfo($"Stopping '{SelectedConfiguration.Crypto.CryptoName}' miner..."); ConsoleOutput.Add($"Stopping '{SelectedConfiguration.Crypto.CryptoName}' miner..."); StopMiner(); UIIsUnlocked = true; PlayIcon = "Play"; StartTooltip = "Start miner"; if (InstanceStore.WorkerStore.HasActiveNonSupportWorkers() == false) { if (SupportJobsAreScheduled == true) { UnscheduleSupportMinerAndStop(); } else { StopSupportMiner(); } } _sw.Stop(); _dt.Stop(); }
private void worker_DoWork(object sender, DoWorkEventArgs e) { var worker = sender as BackgroundWorker; var result = 0; if (worker == null) { DispatchService.Invoke(() => ConsoleOutput.Add(string.Format("{0}: Error starting the import cgxml module (worker is null)", DateTime.Now.ToString(CultureInfo.InvariantCulture)))); return; } StreamWriter streamWriter = null; StringBuilder builder = null; string[] files = null; try { if (_cgxmlFolderPath == null) { e.Cancel = true; return; } files = _multipleImport == true?Directory.GetFiles(_cgxmlFolderPath[0]) : _cgxmlFolderPath; streamWriter = new StreamWriter(_csvPath); builder = new StringBuilder(); builder.AppendLine("Land_Nr. CF(hartie), Land_Nr.CAD, Land_Topo,ID Eterra, Supraf. Acte, Supraf Mas, CadGenId, Nr.Titlu, Nr. Tarla, Mentiuni parcela, Parcel_Topo,PARCELNO,Proprietar"); streamWriter.Write(builder); } catch (Exception ex) { ////DispatchService.Invoke(() => ConsoleOutput.Add(string.Format("Error: {0}",ex.Message))); _cancelMessage = ex.Message; e.Cancel = true; return; } for (var i = 0; i < files.Length; ++i) { if (worker.CancellationPending) { e.Cancel = true; break; } try { if (string.Compare(Path.GetExtension(files[i]), ".cgxml", true, CultureInfo.InvariantCulture) != 0) { continue; } CGXML cg = ReadCGXML(files[i]); if (cg == null) { DispatchService.Invoke(() => ConsoleOutput.Add(string.Format("{0}: Eroare citire fisier {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture) , Path.GetFileName(files[i])))); continue; } builder.Clear(); if (cg.Land != null) { builder.Append(RemoveSpecialCharFromString(cg.Land.PAPERLBNO?.Trim())); builder.Append(","); builder.Append(RemoveSpecialCharFromString(cg.Land.PAPERCADNO?.Trim())); builder.Append(","); builder.Append(RemoveSpecialCharFromString(cg.Land.TOPONO?.Trim())); builder.Append(","); builder.Append(RemoveSpecialCharFromString(cg.Land.E2IDENTIFIER?.Trim())); builder.Append(","); builder.Append(cg.Land.PARCELLEGALAREA); builder.Append(","); builder.Append(cg.Land.MEASUREDAREA); builder.Append(","); builder.Append(RemoveSpecialCharFromString(cg.Land.CADGENNO?.Trim())); builder.Append(","); } else { builder.Append(",,,,,,,"); } if (cg.Parcel != null) { StringBuilder tarla = new StringBuilder(); StringBuilder titlu = new StringBuilder(); StringBuilder mentiuni = new StringBuilder(); StringBuilder parcelTopo = new StringBuilder(); StringBuilder parcelNo = new StringBuilder(); foreach (var p in cg.Parcel) { if (!string.IsNullOrEmpty(p.LANDPLOTNO)) { tarla.Append(RemoveSpecialCharFromString(p.LANDPLOTNO?.Trim()) + "; "); } if (!string.IsNullOrEmpty(p.TITLENO)) { titlu.Append(RemoveSpecialCharFromString(p.TITLENO?.Trim()) + "; "); } if (!string.IsNullOrEmpty(p.NOTES)) { mentiuni.Append(RemoveSpecialCharFromString(p.NOTES?.Trim()) + "; "); } if (!string.IsNullOrEmpty(p.TOPONO)) { parcelTopo.Append(RemoveSpecialCharFromString(p.TOPONO?.Trim()) + "; "); } if (!string.IsNullOrEmpty(p.PARCELNO)) { parcelNo.Append(RemoveSpecialCharFromString(p.PARCELNO?.Trim(), "_") + "; "); } } var titluStr = titlu?.ToString().TrimEnd(' ', ';'); var tarlaStr = tarla?.ToString().TrimEnd(' ', ';'); var mentiuniStr = mentiuni?.ToString().TrimEnd(' ', ';'); var parcelTopoStr = parcelTopo?.ToString().TrimEnd(' ', ';'); var parcelNoStr = parcelNo?.ToString().TrimEnd(' ', ';', '_'); builder.Append(titluStr); builder.Append(","); builder.Append(tarlaStr); builder.Append(","); builder.Append(mentiuniStr); builder.Append(","); builder.Append(parcelTopoStr); builder.Append(","); builder.Append(parcelNoStr); builder.Append(","); } else { builder.Append(",,,"); } if (cg.Person != null) { StringBuilder nume = new StringBuilder(); foreach (var p in cg.Person) { if (!string.IsNullOrEmpty(p.FIRSTNAME) || !string.IsNullOrEmpty(p.LASTNAME)) { p.FIRSTNAME = RemoveSpecialCharFromString(p.FIRSTNAME); p.LASTNAME = RemoveSpecialCharFromString(p.LASTNAME);; nume.AppendFormat("{0} {1}", p.FIRSTNAME?.Trim(), p.LASTNAME?.Trim()); } } var numeStr = nume?.ToString().TrimEnd(); if (numeStr.EndsWith(";")) { numeStr.Remove(numeStr.Length - 1, 1); } builder.Append(numeStr); } streamWriter.WriteLine(builder); DispatchService.Invoke(() => ConsoleOutput.Add(string.Format("{0}: Fisierul {1} importat cu succes", DateTime.Now.ToString(CultureInfo.InvariantCulture), Path.GetFileName(files[i])))); } catch (Exception ex) { DispatchService.Invoke(() => ConsoleOutput.Add(string.Format("{0}: Eroare citire fisier {1}. {2}", DateTime.Now.ToString(CultureInfo.InvariantCulture) , Path.GetFileName(files[i]), ex.Message))); continue; } if (worker.WorkerReportsProgress) { worker.ReportProgress((i + 1) * 100 / files.Length); } result = i + 1; } e.Result = result; streamWriter.Close(); }
private void ConsoleCommand_ConsoleLineReceived(object sender, string e) { ConsoleOutput.Add(e); }
public void WriteToConsole(string text) { ConsoleOutput.Add(text); }