public BotController(ILogger logger, IPPather pather, DataConfig dataConfig, IConfiguration configuration) { this.logger = logger; this.pather = pather; this.DataConfig = dataConfig; this.areaDb = new AreaDB(logger, dataConfig); updatePlayerPostion.Start(); wowProcess = new WowProcess(); WowScreen = new WowScreen(logger, wowProcess); WowProcessInput = new WowProcessInput(logger, wowProcess); var frames = DataFrameConfiguration.LoadFrames(); var scad = new StartupConfigAddonData(); configuration.GetSection(StartupConfigAddonData.Position).Bind(scad); if (scad.Mode == "Network") { logger.LogInformation("Using NetworkedAddonDataProvider"); addonDataProvider = new NetworkedAddonDataProvider(logger, scad.myPort, scad.connectTo, scad.connectPort); } else { logger.LogInformation("Using AddonDataProvider"); addonDataProvider = new AddonDataProvider(WowScreen, frames); } AddonReader = new AddonReader(logger, DataConfig, areaDb, addonDataProvider); minimapNodeFinder = new MinimapNodeFinder(WowScreen, new PixelClassifier()); MinimapImageFinder = minimapNodeFinder as IImageProvider; addonThread = new Thread(AddonRefreshThread); addonThread.Start(); // wait for addon to read the wow state var sw = new Stopwatch(); sw.Start(); while (AddonReader.PlayerReader.Sequence == 0 || !Enum.GetValues(typeof(PlayerClassEnum)).Cast <PlayerClassEnum>().Contains(AddonReader.PlayerReader.PlayerClass)) { if (sw.ElapsedMilliseconds > 5000) { logger.LogWarning("There is a problem with the addon, I have been unable to read the player class. Is it running ?"); sw.Restart(); } Thread.Sleep(100); } logger.LogDebug($"Woohoo, I have read the player class. You are a {AddonReader.PlayerReader.PlayerClass}."); npcNameFinder = new NpcNameFinder(logger, WowScreen, WowProcessInput); WowScreen.AddDrawAction(npcNameFinder.ShowNames); //ActionFactory = new GoalFactory(AddonReader, logger, wowProcess, npcNameFinder); screenshotThread = new Thread(ScreenshotRefreshThread); screenshotThread.Start(); }
public BotController(ILogger logger) { wowProcess = new WowProcess(logger); this.WowScreen = new WowScreen(logger); this.logger = logger; var frames = DataFrameConfiguration.ConfigurationExists() ? DataFrameConfiguration.LoadConfiguration() : new List <DataFrame>(); //config.CreateConfiguration(WowScreen.GetAddonBitmap()); AddonReader = new AddonReader(WowScreen, frames, logger); minimapNodeFinder = new MinimapNodeFinder(new PixelClassifier()); MinimapImageFinder = minimapNodeFinder as IImageProvider; addonThread = new Thread(AddonRefreshThread); addonThread.Start(); // wait for addon to read the wow state while (AddonReader.PlayerReader.Sequence == 0 || !Enum.GetValues(typeof(PlayerClassEnum)).Cast <PlayerClassEnum>().Contains(AddonReader.PlayerReader.PlayerClass)) { logger.LogWarning("There is a problem with the addon, I have been unable to read the player class. Is it running ?"); Thread.Sleep(100); } npcNameFinder = new NpcNameFinder(wowProcess, AddonReader.PlayerReader, logger); ActionFactory = new GoalFactory(AddonReader, logger, wowProcess, npcNameFinder); screenshotThread = new Thread(ScreenshotRefreshThread); screenshotThread.Start(); }
public static INodeFinder CreateFinder(string finder, TypeReflectorOptions options) { INodeFinder f = Factories.Finder.Create(finder); uint cur = (uint)f.BindingFlags; SetFlag(ref cur, options.FlattenHierarchy, (uint)BindingFlags.FlattenHierarchy); SetFlag(ref cur, options.ShowNonPublic, (uint)BindingFlags.NonPublic); SetFlag(ref cur, options.ShowInheritedMembers, (uint)BindingFlags.FlattenHierarchy); f.BindingFlags = (BindingFlags)cur; cur = (uint)f.FindMembers; SetFlag(ref cur, options.ShowBase, (uint)FindMemberTypes.Base); SetFlag(ref cur, options.ShowConstructors, (uint)FindMemberTypes.Constructors); SetFlag(ref cur, options.ShowEvents, (uint)FindMemberTypes.Events); SetFlag(ref cur, options.ShowFields, (uint)FindMemberTypes.Fields); SetFlag(ref cur, options.ShowInterfaces, (uint)FindMemberTypes.Interfaces); SetFlag(ref cur, options.ShowMethods, (uint)FindMemberTypes.Methods); SetFlag(ref cur, options.ShowProperties, (uint)FindMemberTypes.Properties); SetFlag(ref cur, options.ShowTypeProperties, (uint)FindMemberTypes.TypeProperties); SetFlag(ref cur, options.ShowMonoBroken, (uint)FindMemberTypes.MonoBroken); SetFlag(ref cur, options.VerboseOutput, (uint)FindMemberTypes.VerboseOutput); f.FindMembers = (FindMemberTypes)cur; return(f); }
public BotController(ILogger logger, IPPather pather) { wowProcess = new WowProcess(logger); wowProcess.KeyPress(ConsoleKey.F3, 400).Wait(); // clear target this.WowScreen = new WowScreen(logger); this.logger = logger; this.pather = pather; var frames = DataFrameConfiguration.ConfigurationExists() ? DataFrameConfiguration.LoadConfiguration() : new List <DataFrame>(); //config.CreateConfiguration(WowScreen.GetAddonBitmap()); AddonReader = new AddonReader(WowScreen, frames, logger); minimapNodeFinder = new MinimapNodeFinder(new PixelClassifier()); MinimapImageFinder = minimapNodeFinder as IImageProvider; addonThread = new Thread(AddonRefreshThread); addonThread.Start(); // wait for addon to read the wow state var sw = new Stopwatch(); sw.Start(); while (AddonReader.PlayerReader.Sequence == 0 || !Enum.GetValues(typeof(PlayerClassEnum)).Cast <PlayerClassEnum>().Contains(AddonReader.PlayerReader.PlayerClass)) { if (sw.ElapsedMilliseconds > 5000) { logger.LogWarning("There is a problem with the addon, I have been unable to read the player class. Is it running ?"); sw.Restart(); } Thread.Sleep(100); } logger.LogDebug($"Woohoo, I have read the player class. You are a {AddonReader.PlayerReader.PlayerClass}."); npcNameFinder = new NpcNameFinder(wowProcess, AddonReader.PlayerReader, logger); //ActionFactory = new GoalFactory(AddonReader, logger, wowProcess, npcNameFinder); screenshotThread = new Thread(ScreenshotRefreshThread); screenshotThread.Start(); }
public MainWindow() { InitializeComponent(); this.DataContext = LogEntries = new ObservableCollection <LogEntry>(); this.pixelClassifier = new PixelClassifier(); this.bobberFinder = new SearchForNode(pixelClassifier); var imageProvider = bobberFinder as IImageProvider; if (imageProvider != null) { imageProvider.NodeEvent += ImageProvider_BitmapEvent; } this.WindowSizeChangedTimer = new Timer { AutoReset = false, Interval = 100 }; this.Closing += (s, e) => botThread?.Abort(); }
/// <summary> /// Initializes a new instance of the <see cref="UiService"/> class. /// </summary> /// <param name="screenDumper">The screen dumper.</param> /// <param name="nodeParser">The node parser.</param> /// <param name="nodeFinder">The node finder.</param> public UiService(IScreenDumper screenDumper, INodeParser nodeParser, INodeFinder nodeFinder) { if (screenDumper == null) { throw new ArgumentNullException(nameof(screenDumper)); } if (nodeParser == null) { throw new ArgumentNullException(nameof(nodeParser)); } if (nodeFinder == null) { throw new ArgumentNullException(nameof(nodeFinder)); } _screenDumper = screenDumper; _nodeParser = nodeParser; _nodeFinder = nodeFinder; Extensions = new List <IUiExtension>(); }
public PathedJsonSorter(SorterRequirements required, INodeFinder finder, NodeMatcher matches) : base(required) { Finder = finder; Matches = matches; }
public NodeBot(INodeFinder bobberFinder) { this.NodeFinder = bobberFinder; }
public Node(INodeFormatter formatter, INodeFinder finder) { this.formatter = formatter; this.finder = finder; }
public GroupingNodeFinder(INodeFinder finder) { this.finder = finder; }
public static void Execute(string[] args) { InitFactories(); TypeReflectorOptions options = new TypeReflectorOptions(); bool quit = false; try { options.ParseOptions(args); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine("See `{0} --help' for more information", ProgramOptions.ProgramName); return; } foreach (DictionaryEntry de in Factories.Displayer) { Trace.WriteLine( string.Format("registered displayer: {0}={1}", de.Key, ((TypeFactoryEntry)de.Value).Type)); } if (options.FoundHelp) { Console.WriteLine(options.OptionsHelp); quit = true; } if (options.DefaultAssemblies) { Console.WriteLine("The default search assemblies are:"); foreach (string s in TypeReflectorOptions.GetDefaultAssemblies()) { Console.WriteLine(" {0}", s); } quit = true; } if (options.Version) { PrintVersion(); quit = true; } if (quit) { return; } TraceArray("Explicit Assemblies: ", options.Assemblies); TraceArray("Referenced Assemblies: ", options.References); TraceArray("Search for Types: ", options.Types); TypeLoader loader = CreateLoader(options); TraceArray("Actual Search Assemblies: ", loader.Assemblies); TraceArray("Actual Search Assemblies: ", loader.References); ITypeDisplayer displayer = CreateDisplayer(options); if (displayer == null) { Console.WriteLine("Error: invalid displayer: " + options.Displayer); return; } if (loader.Assemblies.Count == 0 && loader.References.Count == 0 && displayer.AssembliesRequired) { Console.WriteLine("Error: no assemblies specified."); Console.WriteLine("See `{0} --help' for more information", ProgramOptions.ProgramName); return; } INodeFormatter formatter = CreateFormatter(options); if (formatter == null) { Console.WriteLine("Error: invalid formatter: " + options.Formatter); return; } INodeFinder finder = CreateFinder(options); if (finder == null) { Console.WriteLine("Error: invalid finder: " + options.Finder); return; } displayer.Finder = finder; displayer.Formatter = formatter; displayer.Options = options; displayer.InitializeInterface(); IList types = options.Types; if (types.Count == 0) { types = new string[] { "." } } ; // Find the requested types and display them. if (loader.Assemblies.Count != 0 || loader.References.Count != 0) { FindTypes(displayer, loader, types); } displayer.Run(); }
public DiffGenerator(INodeTraverser nodeTraverser, INodeFinder nodeFinder, INodeComparer nodeComparer) { NodeTraverser = nodeTraverser; NodeFinder = nodeFinder; NodeComparer = nodeComparer; }
public Node (INodeFormatter formatter, INodeFinder finder) { this.formatter = formatter; this.finder = finder; }
public GroupingNodeFinder (INodeFinder finder) { this.finder = finder; }
public KeyMover(YamlMappingNode node) { Include = new ForwardNodeFinder(node.Go("from").ToList(x => NodeMatcher.Create(x))); Destination = node.Go("to").ToList(x => new NameNodeMatcher(x.String())).ToArray(); }