public void Execute(IPluginProgressProvider progress) { var node = Context.Controller.SelectedNode; if (node == null) { throw new InvalidOperationException("The aggregated analysis can only be run when action node is selected"); } progress.UpdateProgress("Started"); AggregationRunner result = new AggregationRunner(node, progress, this.Context); result.CFRFilePaths = new List <string>(); if (Context.Controller.CurrentFileName == null) { throw new InvalidOperationException("Unknown location of current tree."); } var dirName = Path.GetDirectoryName(Context.Controller.CurrentFileName); var files = Directory.GetFiles(dirName, "*.cfr"); var msg = "Perform analysis over " + files.Length + " files in " + dirName + "?" + Environment.NewLine + "Please not that it only makes sense if all trees are identical except for the board."; var dialogResult = MessageBox.Show(msg, "Confirm aggregation?", MessageBoxButtons.YesNoCancel); if (dialogResult == DialogResult.Yes) { result.CFRFilePaths.AddRange(files); result.RunReport(); var fileName = Context.Controller.CurrentFileName; progress.UpdateProgress("Generating intro"); } }
public AggregationRunner(IServerNode node, IPluginProgressProvider progress, IServerPluginContext context) { this.Node = node; this.Context = context; this.ProgressProvider = progress; this.ActionLine = GenerateLineString(node); this.ReportBuilder = new StringBuilder(); this.BoardLen = node.Board.Length; }
public void Execute(IPluginProgressProvider progress) { //If the user selects plugin from the menu we can ask controller about currently selected node. IServerNode currentlySelectedNode = Context.Controller.SelectedNode; if (currentlySelectedNode == null) { MessageBox.Show("There is no node selected at the moment"); return; } // We want to ask for range, ev and equity of a current player to act. // If it is not action node - we will show those values for OOP Player IServerPlayer player; // We can get the action player from currently selected node if (currentlySelectedNode.ActionPlayer != null) { player = currentlySelectedNode.ActionPlayer; } else { // This is the way to get OOP player object from the API player = this.Context.ServerUtils.OOP; } // We will get the weight, ev and equity of the single holding AsQs, // average of all the holding in the AQ+ category // and total for all hands // We can construct a hand object by parsing single hand PioViewerApi.Util.Hand asqs = new Hand("AQss"); // We can also parse range using utility method. Range object is a holder of hand, weight pairs PioViewerApi.Util.IRange aqplus = this.Context.ServerUtils.CreateRange("AQ+"); //We will collect the information in the String Builder object. StringBuilder result = new StringBuilder(); result.AppendLine("Basic report for " + player.Name + " in node " + currentlySelectedNode.NodeId); // This is how you convert a hand to nice looking string, and get the human readable format of a range result.AppendLine("Reporting range, EV and equity for " + asqs.ToUnicodeString() + " and subrange " + aqplus.ToSingleLineString()); // Ask solver for the range of a given player in a node IRange range = this.Context.ServerWrapper.ShowRange(player, currentlySelectedNode); // Ask solver for equity EVRange equity = this.Context.ServerWrapper.CalcEquityInNode(player, currentlySelectedNode); // Ask solver for EV EVRange ev = this.Context.ServerWrapper.CalcEVInNode(player, currentlySelectedNode); ReportRange(result, asqs, aqplus, range); result.AppendLine("Equity:"); ReportEVEquity(result, equity, asqs, aqplus); result.AppendLine("EV:"); ReportEVEquity(result, ev, asqs, aqplus); MessageBox.Show(result.ToString(), "Tutorial 4"); }
public void Execute(IPluginProgressProvider progress) { //If the user selects plugin from the menu we can ask controller about currently selected node. IServerNode currentlySelectedNode = Context.Controller.SelectedNode; //If there is no node selected - the property will be null. if (currentlySelectedNode == null) { MessageBox.Show("There is no node selected at the moment"); } else { MessageBox.Show(currentlySelectedNode.NodeText + " is currently selected"); } }
public void Execute(IPluginProgressProvider progress) { //If the user selects plugin from the menu we can ask controller about currently selected node. IServerNode currentlySelectedNode = Context.Controller.SelectedNode; if (currentlySelectedNode == null) { MessageBox.Show("There is no node selected at the moment"); return; } if (currentlySelectedNode.Parent == null) { MessageBox.Show("Selected node has no parent"); return; } this.Context.Controller.SelectedNode = currentlySelectedNode.Parent; }
public void Execute(IPluginProgressProvider progress) { var node = Context.Controller.SelectedNode; if (node == null) { throw new InvalidOperationException("The aggregated analysis can only be run when action node is selected"); } progress.UpdateProgress("Started"); AggregationRunner result = new AggregationRunner(node, progress, this.Context); result.RunReport(); var fileName = Context.Controller.CurrentFileName; progress.UpdateProgress("Generating intro"); }
public void Execute(IPluginProgressProvider progress) { new TreeBrowsingForm(Context).Show(); }
public void Execute(IPluginProgressProvider progress) { MessageBox.Show("Hello world!"); }