private void OnHelperGameRunning(object sender, InterpretEventArgs args) { if (args.GameRunning) { Console.WriteLine("OnHelperGameRunning"); helper.StartWebCrawling(); } }
private void OnHelperLevelUp(object sender, InterpretEventArgs args) { _level = args.Level; helper.GetLevelMessages(_level, out _flaskMessage, out _currentLevelMessages); // helper.GetLevelMessages2(_level, out _currentFlaskMessage, out _currentLevelMessages); SetLevelContent(); }
protected virtual void OnRaiseLevelEvent(InterpretEventArgs e) { EventHandler <InterpretEventArgs> handler = InterpreterEvent; if (handler != null) { handler(this, e); } }
private void OnHelperZoneChange(object sender, InterpretEventArgs args) { _zone = args.Zone; this.Dispatcher.Invoke(new Action(() => { this.lbl_zone.Content = _zone; })); helper.GetZoneMessages(_zone, out _currentQuestMessages, out _currentZoneMessages); // helper.GetZoneMessages2(_zone, out _currentQuestMessagesStringList, out _currentZoneMessagesStringList); SetZoneContent(); }
public void Crawl(string fileToSave = null) { HttpClient client = new HttpClient(); string answer = client.GetStringAsync(_url).Result; if (fileToSave != null) { System.IO.File.WriteAllText(fileToSave, answer); } InterpretEventArgs interpreted = Interpreter.InterpretLine(answer); OnRaiseLevelEvent(interpreted); }
private void CustomWatcher(string path) { running = true; while (running) { FileInfo fi = new FileInfo(ClientFile); // Console.WriteLine(fi.Length); if (fi.Length > fileLength) { FileInfo newFI = fi.CopyTo("ClientCopy", true); using (FileStream fs = newFI.OpenRead()) { fs.Seek(fileLength, SeekOrigin.Begin); int size = (int)(fs.Length - fileLength); if (size > 0) { byte[] data = new byte[size]; fs.Read(data, 0, size); UTF8Encoding enc = new UTF8Encoding(true); string addedLine = enc.GetString(data); // Console.WriteLine(addedLine); for (int i = LineInterpreters.Count - 1; i >= 0; --i) { InterpretEventArgs interpreted = LineInterpreters[i].InterpretLine(addedLine); if (interpreted != null) { OnRaiseLevelEvent(interpreted); } } } else { Console.WriteLine("{0} nothing changed in {1}", DateTime.Now, path); } } } fileLength = fi.Length; Thread.Sleep(100); } }
private void OnHelperWebCrawl(object sender, InterpretEventArgs args) { _chName = args.CharName; _chClass = args.CharClass; _level = args.Level; // this crashes, find out how to set labelContent this.Dispatcher.Invoke(new Action(() => { this.lbl_name.Content = _chName; this.lbl_class.Content = _chClass; this.lbl_level.Content = "Level " + _level; })); helper.ReadMesageFiles(); helper.StartLevelingMonitoring(); helper.GetLevelMessages(_level, out _flaskMessage, out _currentLevelMessages); // helper.GetLevelMessages2(_level, out _currentFlaskMessageString, out _currentLevelMessagesStringList); SetLevelContent(); SetClassImage(); }
private void OnHelperInitialized(object sender, InterpretEventArgs args) { }