public Player(Animation[] anims, float imageScale, Vector2 loc, InputManager input) : base(anims, imageScale, loc) { _input = input; NewLogEntry = new TestLogEntry(null, State.GetHashCode()); LogList.Add(NewLogEntry); MoveDist = new Vector2(6, 0); }
public void InsertLog(string newItem) { SelectedIndexLog = LogList.Count; var printIdx = (SelectedIndexLog % 1000).ToString("D2"); LogList.Add(printIdx + ": " + newItem); }
public Boolean addNewLog(DateTime date, string tableName, int userId, string action) { try { int maxLogId = 0; //need some code to avoid dulicate usernames //maybe add some logic (busiess rules) about password policy //IUser user = new User(name, password, userType); // Construct a User Object foreach (Log log in LogList) { if (log.LogId > maxLogId) { maxLogId = log.LogId; } } ILog theLog = LogFactory.GetLog(maxLogId + 1, date, tableName, userId, action); // Using a Factory to create the user entity object. ie seperating object creation from business logic LogList.Add(theLog); // Add a reference to the newly created object to the Models UserList DataLayer.addNewLogToDB(theLog); //Gets the DataLayer to add the new user to the DB. return(true); } catch (System.Exception excep) { return(false); } }
public BinanceWrapper() { client = new BinanceClient(new BinanceClientOptions { ApiCredentials = new ApiCredentials(Settings.Items.BinanceAPIKEY, Settings.Items.BinanceAPISECRET) }); var startResult = client.Spot.UserStream.StartUserStream(); if (!startResult.Success) { Console.WriteLine($"Failed to start user stream: {startResult.Error}"); } else { var symbols = GetAllSymbols(); var v = from a in symbols select a.Name; var socketClient = new BinanceSocketClient(); socketClient.Spot.SubscribeToUserDataUpdates( startResult.Data, (a) => AccountInfos.Add(a), (a) => OrderUpdates.Add(a), (a) => OrderLists.Add(a), (a) => PositionsUpdates.Add(a), (a) => BalanceUpdates.Add(a)); } }
public void AnswerToAllQuestions(Subject subject, ResponseAlgorithm responseAlgorithm) { var questionsList = _webDriver.FindElements(By.ClassName("qtext")); LogList.Add($"Catched {questionsList.Count} questions"); int i = 1; foreach (var question in questionsList) { string answer = responseAlgorithm(question.Text); string xpath = $"//label[contains(normalize-space(substring(text(), 2)), '{answer.Trim()}')]"; if (CheckExistsElement(xpath)) { var answerLabel = _webDriver.FindElement(By.XPath(xpath)); string answerInputId = answerLabel.GetAttribute("for"); _webDriver.FindElement(By.Id(answerInputId)).Click(); LogList.Add($"{i} question answered"); } else { LogList.Add($"{i} question not answered"); } Thread.Sleep(1000); i++; } LogList.Add("Finished!"); }
private async Task LoadDataTask() { LogList.Clear(); int o = 0; int i = -1; while (true) { if (i >= 50) { break; } string reqUri = "index.php?action=gate&a2=logs&_o=" + o; string responseString = await SendRequest.GET(reqUri); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(responseString); HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes(@"//td[@class='dbg' and @valign='top']"); if (nodes == null) { break; } foreach (HtmlNode n in nodes) { LogModel l = new LogModel(); l.Time = n.InnerText; LogList.Add(l); } HtmlNodeCollection nodes2 = doc.DocumentNode.SelectNodes(@"//textarea[@name='log_str']"); foreach (HtmlNode n2 in nodes2) { i++; string s = n2.InnerText; LogList[i].Logs = s; if (s.Contains("[localhost]") || s.Contains("Origin proxy") || s.Contains("Kernel")) { LogList[i].Alert = 0; } else if (s.Contains("Download")) { LogList[i].Alert = 1; } else { LogList[i].Alert = 2; } } o += 10; } //end while }
/// <summary> /// Initializes a new instance of the <see cref="DomainModelResolveViewModel"/> class. /// </summary> /// <param name="log">The log.</param> public DomainModelResolveViewModel(Action <string, Category, Prism.Logging.Priority> log) { ClearUserInterface(); LookupDNSCommand = DelegateCommand.FromAsyncHandler(DomainDiscoveryAsync); InformationModelURI = new Uri(Properties.Settings.Default.DefaultInformationModelUri); m_Logger = log; m_LoggerAction = (x, y, z) => { LogList.Add(x); m_Logger(x, y, z); }; }
private async void RefreshDeviceProc() { _isLoadingDevices = true; LogList.Add("Reloading Devices"); await RefreshDeviceProcAsync(); _isLoadingDevices = false; }
public void Append(LogLevel level, string message) { if (level >= MinimumLogLevel) { NewMessage?.Invoke(level, message); Messages.Add(level, message); } }
protected override void Write(LogEventInfo aLogEvent) { _logs.Add(Layout.Render(aLogEvent)); while (_logs.Count > MaxLogs) { _logs.RemoveAt(0); } }
public void NewLog(GuildLogData log) { LogList.Add(log); if (LogList.Count > ConfigEnvSet.GetInt("Guild.GuildLogCountMax")) { LogList.RemoveAt(0); } }
private void Refresh() { m_sRefreshTime = System.DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"); LogList.Clear(); CmdManager.ClearLog(); CmdManager.RunCmd("ipconfig /all"); LogList.Add(CmdManager.ReadLog()); }
// Makes the list box thread safe. private int GetListBoxIndex(string initialMessage) { ListBoxSpotReservationEvent.WaitOne(); Dispatcher.Invoke(() => LogList.Add(initialMessage)); int index = LogList.Count - 1; ListBoxSpotReservationEvent.Set(); return(index); }
public void PushLog(EnemyLogData log) { if (LogList.Count >= DataHelper.MaxMailNum) { LogList.RemoveAt(0); } IsHaveNewLog = true; LogList.Add(log); }
/// <summary> /// 对指定路径进行检测,提取出定义文件和数据文件。 /// </summary> /// <param name="path"></param> /// <returns></returns> private bool CheckFiles(string path) { try { //清空数据 defFiles.Clear(); dataFiles.Clear(); //载入路径所有文件 string[] fls = Directory.GetFiles(path); //根据全名分辨是数据文件还是定义文件,并分别保存至defFile和files for (int i = 0; i < fls.Length; i++) { string filename = Path.GetFileNameWithoutExtension(fls[i]); string ext = Path.GetExtension(fls[i]); if (ext.ToLower().Equals(".txt")) { if (filename.Substring(0, 2) == "20") { dataFiles.Add(fls[i]); } else if (filename.Split('_').Length > 2) { defFiles.Add(fls[i]); } } } if (defFiles.Count == 0 && dataFiles.Count == 0) { return(true); } //没有定义文件 if (defFiles.Count == 0) { LogList.Add("缺少定义文件,请检查后再进行转换。"); return(false); } //没有数据文件 if (dataFiles.Count == 0) { LogList.Add("缺少数据文件,请检查后再进行转换。"); return(false); } } catch (Exception e1) { LogList.Add(e1.Message); return(false); } return(true); }
private async void GetLogAsync(int indexer) { StartActivityIndication(TextConstants.ActivityGettingLog); LogList.Clear(); await Task.Run(async() => { if (!await _bluetooth.TurnOnBluetoothAsync(1000, 25)) { ShowMessage(TextConstants.BluetoothTurnOnFail, TextConstants.ButtonClose); return; } if (!await _bluetooth.CreateConnectionAsync(5000, 50)) { ShowMessage(TextConstants.BluetoothConnectionFail, TextConstants.ButtonClose); return; } KeyVendorCommand getLogCommand = new KeyVendorCommand { UserUUID = _user.UUID, Time = DateTime.Now, CommandType = KeyVendorCommandType.GetLog, Data = indexer.ToString() }; KeyVendorTerminal terminal = new KeyVendorTerminal(_bluetooth); KeyVendorAnswer answer = await terminal.ExecuteCommandAsync(getLogCommand, 15000, 100); if (!answer.IsCorrect || answer.AnswerType != KeyVendorAnswerType.Success) { ShowMessage(TextConstants.ErrorGetLogFail, TextConstants.ButtonClose); return; } string answerData = answer.Data; string[] dataArray = answerData.Split('@'); for (int i = 0; i < dataArray.Length; i += 6) { LogInfo logInfo = new LogInfo { UUID = dataArray[i], Time = dataArray[i + 1], Command = ((KeyVendorCommandType)(int.Parse(dataArray[i + 2]))).ToString(), Answer = ((KeyVendorAnswerType)(int.Parse(dataArray[i + 3]))).ToString(), Data = dataArray[i + 4], UserName = dataArray[i + 5] }; LogList.Add(logInfo); } }); UpdateCommands(); StopActivityIndication(); }
protected override void Write(LogEventInfo aLogEvent) { try { Dispatcher.FromThread(_winThread).Invoke(() => _logs.Add(Layout.Render(aLogEvent))); } catch (TaskCanceledException) { // noop } }
public static void Write(string logMessage) { string logMsg; lock (sync) { Counter++; logMsg = "(" + Counter + ") " + DateTime.Now + " | " + logMessage; LogList.Add(logMsg); } }
public void WriteLog(string pos, string content, int level = 1) { Positions.Add(pos); LogList.Add(new LogInfo() { PositionStr = pos, Content = content, Level = level }); }
private void addToLog(object sender, BlitzEventArgs e) { var log = new Log { clientId = _guid, timestamp = e.timestamp, message = e.msg, header = e.msgheader, kind = moodtoString(e.mood) }; if (e.saved) { LogList.Add(log); } }
private void grabLogEntry(string testname, XmlElement logElement) { string importance = logElement.GetAttribute("importance"); string message = logElement.InnerText; LogStruct log = new LogStruct(); log.TestName = testname; log.importance = Util.StringToLogImportance(importance); log.LogEntry = message; LogList.Add(log); }
public List <BinanceSymbol> GetAllSymbols() { if (!File.Exists(Symbols.LogFile)) { BinanceExchangeInfo exchangeInfo = client.Spot.System.GetExchangeInfo().Data; foreach (BinanceSymbol symbol in exchangeInfo.Symbols) { Symbols.Add(symbol); } } return(Symbols.ReadAll()); }
public void UpdateLogs(UpdateLogListMessage sender = null) { if (fetcher.IsLoaded()) { List <LogLevel> filters = (sender != null ? (sender.Filters != null?(List <LogLevel>)sender.Filters:new List <LogLevel>()) : new List <LogLevel>()); IList <Log> logs = fetcher.GetLogs(filters); SelectedItem = new LogListItemViewModel(messenger, new Log()); LogList.Clear(); foreach (Log log in logs) { LogList.Add(new LogListItemViewModel(messenger, log)); } } }
public void PushCombatLog(CombatLogData log) { if (LogList.Count >= DataHelper.CombatLogCountMax) { LogList.RemoveAt(0); } LogList.Add(log); if (log.Type == EventType.PassiveChallenge) { IsHaveNewLog = true; } }
private async Task InitializeAsync() { LogList.Add("Initializing..."); BindingOperations.EnableCollectionSynchronization(MessageList, _messageListLock); BindingOperations.EnableCollectionSynchronization(GsmList, _gsmListLock); BindingOperations.EnableCollectionSynchronization(LogList, _logListLock); _watcher = new SerialPortWatcher(); _watcher.PortsChanged += WatcherOnPortsChanged; if (_watcher.ComPorts.Count == 0) { LogList.Add("No Available Device"); return; } await Task.Run(() => ReadDeviceList(_watcher.ComPorts)); }
private static void ApplicationOnApplicationExit(object sender, EventArgs eventArgs) { var fi = new FileInfo(Assembly.GetExecutingAssembly().Location); var logPath = Path.Combine(fi.DirectoryName, "Logs"); if (!Directory.Exists(logPath)) { Directory.CreateDirectory(logPath); } LogList.Add(String.Format("Opening octgn {0}", Path.Combine(fi.DirectoryName, "../", "octgn.exe"))); var fullLogPath = Path.Combine(logPath, DateTime.Now.ToFileTimeUtc().ToString() + ".update.log"); File.WriteAllLines(fullLogPath, LogList); Process.Start(Path.Combine(fi.DirectoryName, "../", "octgn.exe")); }
/// <summary> /// UI 쓰레드에서 이 메소드를 호출합니다. /// 호출되면 LogList에 LogBuffer내용을 복사합니다. /// </summary> /// <returns>마지막에 기록한 작업 결과</returns> public LogInfo UpdateLog() { LogInfo last = null; lock (LogBuffer) { count = LogBuffer.Count; foreach (LogInfo log in LogBuffer) { LogList.Add(log); last = log; } LogBuffer.Clear(); return(last); } }
public List <BinanceWithdrawal> GetAllWithdrawals() { if (!File.Exists(Withdrawals.LogFile)) { var v = client.WithdrawDeposit.GetWithdrawalHistory().Data; if (v != null) { foreach (var order in v) { Withdrawals.Add(order); } } } return(Withdrawals.ReadAll()); }
public List <BinanceDeposit> GetAllDeposits() { if (!File.Exists(Deposits.LogFile)) { var v = client.WithdrawDeposit.GetDepositHistory().Data; if (v != null) { foreach (var order in v) { Deposits.Add(order); } } } return(Deposits.ReadAll()); }
public LogWindowVM() { #if DEBUG for (int i = 0; i < 4; ++i) { LogList.Add(new LogItem { Id = "123", Log = "테스트 로그입니다." }); LogList.Add(new LogItem { Id = "126", Log = "테스트 로그입니다.\n로그 테스트 데이터.\nTEST!" }); LogList.Add(new LogItem { Id = "142", Log = "테스트 로그입니다." }); } #endif }