Esempio n. 1
0
        /// <summary>
        /// Executes the specified script.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="args">The arguments.</param>
        internal static void Execute(string path, params string[] args)
        {
            try
            {
                var scriptBase = new ScriptBase();
                var scriptOptions = ScriptOptions.Default.WithImports(ScriptCompiler.DefaultUsings).WithReferences(ScriptCompiler.DefaultAssemblyReferences);
                var originalSourceResolver = scriptOptions.SourceResolver;
                var originalMetadataResolver = scriptOptions.MetadataResolver;

                scriptOptions = scriptOptions.WithMetadataResolver(new MetadataResolver(originalMetadataResolver));
                scriptOptions = scriptOptions.WithSourceResolver(new SourceResolver(originalSourceResolver));

                var argsCode = Convert(args);
                var scriptState = CSharpScript.RunAsync(argsCode, scriptOptions, scriptBase).Result;

                // TODO: What about loading and clearing metadata?
                scriptState = scriptState.ContinueWithAsync(string.Format(@"#load ""{0}""", path)).Result;
            }
            catch (CompilationErrorException ex)
            {
                Console.Error.WriteLine("Compile errors:");
                foreach (var error in ex.Diagnostics)
                {
                    Console.Error.WriteLine($"  {error}");
                }
            }
        }
        private static void ValidateIndex(ScriptBase Index1)
        {
            var failures = new List<ValidationFailure>();
            Assert.That(Index1.ValidateObject(failures), Is.False);
            Assert.That(failures, Has.Count(1));

            Assert.That(failures[0].Property == "Name");
        }
Esempio n. 3
0
 private Singleton()
 {
     ScriptBase = new ScriptBase("own-scripts", "all-scripts", "available-scripts", "desktop");
 }
Esempio n. 4
0
 public LanguageTestBase()
 {
     langBase = new ScriptBase();
     langBase.Logger.OnConsoleOut += (t) => ScriptConsoleOut += t;
 }
Esempio n. 5
0
 public override bool Match(ScriptBase script)
 {
     return(script.MatchTemplate(MatchKontinueButton));
     //return false;
 }
 public override bool Match(ScriptBase script)
 {
     return(script.MatchTemplate(TitleMap, 95));
 }
Esempio n. 7
0
 public static void Run(ScriptBase script) =>
 RunWith(new PluginRunner(script));
Esempio n. 8
0
 public override bool Match(ScriptBase script)
 {
     return(SceneConditionHandler.HandleConditions(Settings.Instance.Data.SceneConditions["Game"], script));
 }
 public override bool Match(ScriptBase script)
 {
     return(script.MatchTemplate(TutorialMap, 98));
 }
Esempio n. 10
0
        public static void TreeListNodeError(DevExpress.XtraTreeList.GetCustomNodeCellStyleEventArgs e)
        {
            return;

            TreeListNode treeListNode = e.Node;

            if (treeListNode.StateImageIndex == 0)
            {
                return;
            }

            if (ArchAngel.Providers.Database.BLL.Helper.GetBaseType(treeListNode.Tag) == typeof(ScriptBase))
            {
                ScriptBase scriptBase = (ScriptBase)treeListNode.Tag;
                if (scriptBase.Enabled)
                {
                    bool errorNode = false;
                    if (scriptBase.GetType() == typeof(ArchAngel.Providers.Database.Model.Table) ||
                        scriptBase.GetType() == typeof(ArchAngel.Providers.Database.Model.View) ||
                        scriptBase.GetType() == typeof(ArchAngel.Providers.Database.Model.StoredProcedure))
                    {
                        if (CountAlias(Controller.Instance.BllDatabase.EnabledScriptObjects, scriptBase.Alias) > 1)
                        {
                            errorNode = true;
                            //treeListNode.TreeList.SetColumnError(treeListNode.TreeList.Columns[0], "Duplicate alias: More than one item has the same alias. Right-click one of the duplicate nodes to change its name to be unique.");
                        }
                    }

                    if (scriptBase.GetType() == typeof(Column) ||
                        scriptBase.GetType() == typeof(MapColumn))
                    {
                        ScriptObject scriptObject = ((Column)scriptBase).Parent;
                        if (CountAlias(ScriptBLL.GetEnabledColumns(scriptObject.Columns), scriptBase.Alias) > 1)
                        {
                            errorNode = true;
                            //treeListNode.TreeList.SetColumnError(treeListNode.TreeList.Columns[0], "Duplicate alias: More than one column has the same alias. Right-click one of the duplicate columns to change its name to be unique.");
                        }
                    }

                    if (scriptBase.GetType() == typeof(Key))
                    {
                        ArchAngel.Providers.Database.Model.Table table = (ArchAngel.Providers.Database.Model.Table)((Key)scriptBase).Parent;
                        if (CountAlias(ScriptBLL.GetEnabledKeys(table.Keys), scriptBase.Alias) > 1)
                        {
                            errorNode = true;
                            //treeListNode.TreeList.SetColumnError(treeListNode.TreeList.Columns[0], "Duplicate alias: More than one key has the same alias. Right-click one of the duplicate keys to change its name to be unique.");
                        }
                    }

                    if (scriptBase.GetType() == typeof(Filter))
                    {
                        ScriptObject scriptObject = (ScriptObject)((Filter)scriptBase).Parent;
                        if (CountAlias(ScriptBLL.GetEnabledFilters(scriptObject.Filters), scriptBase.Alias) > 1)
                        {
                            errorNode = true;
                            //treeListNode.TreeList.SetColumnError(treeListNode.TreeList.Columns[0], "Duplicate alias: More than one filter has the same alias. Right-click one of the duplicate filters to change its name to be unique.");
                        }
                    }

                    if (scriptBase.GetType() == typeof(OneToOneRelationship) ||
                        scriptBase.GetType() == typeof(OneToManyRelationship) ||
                        scriptBase.GetType() == typeof(ManyToOneRelationship) ||
                        scriptBase.GetType() == typeof(ManyToManyRelationship))
                    {
                        ScriptObject scriptObject = (ScriptObject)((Relationship)scriptBase).Parent;
                        if (CountAlias(ScriptBLL.GetEnabledRelationships(scriptObject.Relationships), scriptBase.Alias) > 1)
                        {
                            errorNode = true;
                            //treeListNode.TreeList.SetColumnError(treeListNode.TreeList.Columns[0], "Duplicate alias: More than one relationship has the same alias. Right-click one of the duplicate relationships to change its name to be unique.");
                        }
                    }

                    if (errorNode)
                    {
                        e.Appearance.ForeColor = Color.Red;
                        // Parents are shown as red also

                        /*TreeListNode parentTreeListNode = treeListNode.ParentNode;
                         * while (parentTreeListNode != null)
                         * {
                         *  //parentTreeListNode.ForeColor = Color.Red;
                         *  parentTreeListNode = parentTreeListNode.ParentNode;
                         * }*/
                    }
                    else
                    {
                        //treeListNode.TreeList.ToolTipController.SetToolTip(treeListNode, "");
                    }
                }
            }

            /*foreach (TreeListNode childTreeListNode in treeListNode.Nodes)
             * {
             *  if (ArchAngel.Providers.Database.BLL.Helper.GetBaseType(childTreeListNode.Tag) == typeof(ScriptBase))
             *  {
             *      ScriptBase scriptBase = (ScriptBase)childTreeListNode.Tag;
             *      if (!scriptBase.Enabled)
             *      {
             *          continue;
             *      }
             *  }
             *
             *  TreeListNodeError(childTreeListNode);
             * }*/
        }
Esempio n. 11
0
            private static Column GetNewScriptBase(ScriptObject[] newScriptObjects, ScriptBase oldImmediateParent, Column oldColumn)
            {
            // Look for script object still existing
            ScriptObject newScriptObject = GetNewScriptBase(newScriptObjects, oldColumn.Parent);

            // Look for column still existing
            Column newColumn = Search.GetColumn(newScriptObject.Columns, oldColumn.Name, false);

            // Stored procedure create columns in place of parameters in order to create filters
            if (newColumn == null && newScriptObject.GetType() == typeof(Model.StoredProcedure))
            {
                Model.StoredProcedure newStoredProcedure = (Model.StoredProcedure)newScriptObject;
                Model.StoredProcedure.Parameter parameter = Search.GetParameter(newStoredProcedure.Parameters, oldColumn.Name);

                if (parameter == null)
                {
                    string errorMessage = oldImmediateParent.GetType().Name + " " + oldImmediateParent.Alias + " references deleted parameter " + oldColumn.Alias + " of script object " + oldColumn.Parent.Alias +
                        ".\n" + oldColumn.GetType().Name + " " + oldColumn.Alias + " does not exist anymore." +
                        "\nPlease delete " + oldColumn.GetType().Name + " " + oldColumn.Alias + " from this " + oldImmediateParent.GetType().Name;
                    throw new Exception(errorMessage);
                }

                // Create columns for parameter as it is used as a filter column
                newColumn = new Column(parameter.Name, false, newScriptObject, parameter.OrdinalPosition, false, parameter.DataType,
                        parameter.Size, false, false, "", true, false, parameter.Precision, parameter.Scale);
            }

            if (newColumn == null)
            {
                string errorMessage = oldImmediateParent.GetType().Name + " " + oldImmediateParent.Alias + " references deleted column " + oldColumn.Alias + " of script object " + oldColumn.Parent.Alias +
                    ".\n" + oldColumn.GetType().Name + " " + oldColumn.Alias + " does not exist anymore." +
                    "\nPlease delete " + oldColumn.GetType().Name + " " + oldColumn.Alias + " from this " + oldImmediateParent.GetType().Name;
                throw new Exception(errorMessage);
            }

            return newColumn;
            }
Esempio n. 12
0
        private static int CountAlias(ScriptBase[] scriptBases, string alias)
        {
            int count = 0;

            foreach (ScriptBase scriptBase in scriptBases)
            {
                if (scriptBase.Alias == alias)
                {
                    count++;
                }
            }

            return count;
        }
Esempio n. 13
0
        private void AddOptionNodes(Node scriptObjectNode, ScriptBase scriptObject)
        {
            string scriptObjectTypeName = scriptObject.GetType().FullName;

            if (scriptObjectTypeName == ModelTypes.MapColumn.FullName ||
                scriptObjectTypeName == ModelTypes.Column.FullName)
            {
                AddIndividualOptions(scriptObjectNode, _optionsForColumns, scriptObject);
            }
            else if (scriptObjectTypeName == ModelTypes.Filter.FullName)
            {
                AddIndividualOptions(scriptObjectNode, _optionsForFilters, scriptObject);
            }
            else if (scriptObjectTypeName == ModelTypes.Index.FullName)
            {
                AddIndividualOptions(scriptObjectNode, _optionsForIndexes, scriptObject);
            }
            else if (scriptObjectTypeName == ModelTypes.Key.FullName)
            {
                AddIndividualOptions(scriptObjectNode, _optionsForKeys, scriptObject);
            }
            else if (scriptObjectTypeName == ModelTypes.ManyToManyRelationship.FullName)
            {
                AddIndividualOptions(scriptObjectNode, _optionsForManyToManyRelationship, scriptObject);
            }
            else if (scriptObjectTypeName == ModelTypes.ManyToOneRelationship.FullName)
            {
                AddIndividualOptions(scriptObjectNode, _optionsForManyToOneRelationship, scriptObject);
            }
            else if (scriptObjectTypeName == ModelTypes.OneToManyRelationship.FullName)
            {
                AddIndividualOptions(scriptObjectNode, _optionsForOneToManyRelationship, scriptObject);
            }
            else if (scriptObjectTypeName == ModelTypes.OneToOneRelationship.FullName)
            {
                AddIndividualOptions(scriptObjectNode, _optionsForOneToOneRelationships, scriptObject);
            }
            else if (scriptObjectTypeName == ModelTypes.ScriptObject.FullName)
            {
                AddIndividualOptions(scriptObjectNode, _optionsForScriptObjects, scriptObject);
            }
            else if (scriptObjectTypeName == ModelTypes.StoredProcedure.FullName)
            {
                AddIndividualOptions(scriptObjectNode, _optionsForStoredProcedures, scriptObject);
            }
            else if (scriptObjectTypeName == ModelTypes.Table.FullName)
            {
                AddIndividualOptions(scriptObjectNode, _optionsForTable, scriptObject);
            }
            else if (scriptObjectTypeName == ModelTypes.View.FullName)
            {
                AddIndividualOptions(scriptObjectNode, _optionsForViews, scriptObject);
            }
            else
            {
                throw new NotImplementedException("Not coded yet:" + scriptObject.GetType().FullName + ". Apparently '" +
                                                  scriptObjectTypeName + "' != '" + ModelTypes.Table.FullName + "'.");
            }
        }
Esempio n. 14
0
 private void UpdateTreeListNodeText(TreeListNode treeListNode, ScriptBase scriptBase)
 {
     string[] columnTexts = GetTreeListNodeText(scriptBase);
     for (int i = 0; i < columnTexts.Length; i++)
     {
         treeListNode.SetValue(i, columnTexts[i]);
     }
     treeListNode.Tag = scriptBase;
 }
Esempio n. 15
0
 public override bool Match(ScriptBase script)
 {
     return(script.MatchTemplate(TowerKonsumablePrompt));
 }
Esempio n. 16
0
        /// <summary>
        /// Adds per-object options to ScriptObject node.
        /// </summary>
        /// <param name="scriptObjectNode"></param>
        /// <param name="scriptObject"></param>
        private void AddOptionNodes(TreeListNode scriptObjectNode, ScriptBase scriptObject)
        {
            string typeName = scriptObject.GetType().ToString();

            switch (typeName)
            {
                case "ArchAngel.Providers.Database.Model.MapColumn":
                case "ArchAngel.Providers.Database.Model.Column":
                    AddIndividualOptions(scriptObjectNode, _optionsForColumns, scriptObject);
                    break;
                case "ArchAngel.Providers.Database.Model.Filter":
                    AddIndividualOptions(scriptObjectNode, _optionsForFilters, scriptObject);
                    break;
                case "ArchAngel.Providers.Database.Model.Index":
                    AddIndividualOptions(scriptObjectNode, _optionsForIndexes, scriptObject);
                    break;
                case "ArchAngel.Providers.Database.Model.Key":
                    AddIndividualOptions(scriptObjectNode, _optionsForKeys, scriptObject);
                    break;
                case "ArchAngel.Providers.Database.Model.ManyToManyRelationship":
                    AddIndividualOptions(scriptObjectNode, _optionsForManyToManyRelationship, scriptObject);
                    break;
                case "ArchAngel.Providers.Database.Model.ManyToOneRelationship":
                    AddIndividualOptions(scriptObjectNode, _optionsForManyToOneRelationship, scriptObject);
                    break;
                case "ArchAngel.Providers.Database.Model.OneToManyRelationship":
                    AddIndividualOptions(scriptObjectNode, _optionsForOneToManyRelationship, scriptObject);
                    break;
                case "ArchAngel.Providers.Database.Model.OneToOneRelationship":
                    AddIndividualOptions(scriptObjectNode, _optionsForOneToOneRelationships, scriptObject);
                    break;
                case "ArchAngel.Providers.Database.Model.ScriptObject":
                    AddIndividualOptions(scriptObjectNode, _optionsForScriptObjects, scriptObject);
                    break;
                case "ArchAngel.Providers.Database.Model.StoredProcedure":
                    AddIndividualOptions(scriptObjectNode, _optionsForStoredProcedures, scriptObject);
                    break;
                case "ArchAngel.Providers.Database.Model.Table":
                    AddIndividualOptions(scriptObjectNode, _optionsForTable, scriptObject);
                    break;
                case "ArchAngel.Providers.Database.Model.View":
                    AddIndividualOptions(scriptObjectNode, _optionsForViews, scriptObject);
                    break;
                default:
                    throw new NotImplementedException("Not coded yet:" + typeName);
            }
        }
Esempio n. 17
0
 public override bool Match(ScriptBase script)
 {
     return(script.MatchTemplate(R_Title, 98) && script.MatchTemplate(P_Rating, 3));
 }
 public override bool Match(ScriptBase script)
 {
     return(script.MatchTemplate(MatchTowerSelectButton));
     //return false;
 }
Esempio n. 19
0
 public override bool Match(ScriptBase script)
 {
     return(script.MatchTemplate(PreMenuMap) || script.MatchTemplate(PreMenu2Map) || script.MatchTemplate(PreMenu3Map));
 }
Esempio n. 20
0
        private static void GetTreeListNodeText(ScriptBase scriptBase, Node node)
        {
            if (scriptBase.GetType() == typeof (Table) ||
                scriptBase.GetType() == typeof (View) ||
                scriptBase.GetType() == typeof (StoredProcedure) ||
                scriptBase.GetType() == typeof (Column) ||
                scriptBase.GetType() == typeof (Filter) ||
                scriptBase.GetType() == typeof (Index) ||
                scriptBase.GetType() == typeof (Key) ||
                scriptBase.GetType() == typeof (Association))
            {
                node.Text = scriptBase.Alias;

                if (scriptBase.Name != scriptBase.Alias)
                {
                    node.Cells[1].Text = scriptBase.Name;
                }
                else
                {
                    node.Cells[1].Text = "";
                }
                return;
            }

            if (scriptBase.GetType() == typeof (MapColumn))
            {
                MapColumn mapColumn = (MapColumn) scriptBase;
                node.Text = scriptBase.Alias;
                node.Cells[1].Text = scriptBase.Name != scriptBase.Alias ? scriptBase.Name : "";
                node.Cells[2].Text = mapColumn.ForeignColumn == null
                                     	? ""
                                     	: mapColumn.ForeignColumn.Parent.Alias + "." + mapColumn.ForeignColumn.Alias;
                return;
            }

            if (scriptBase.GetType() == typeof (OneToOneRelationship) ||
                scriptBase.GetType() == typeof (OneToManyRelationship) ||
                scriptBase.GetType() == typeof (ManyToOneRelationship) ||
                scriptBase.GetType() == typeof (ManyToManyRelationship))
            {
                Relationship relationship = (Relationship) scriptBase;
                node.Text = scriptBase.Alias;
                node.Cells[1].Text = scriptBase.Name != scriptBase.Alias ? scriptBase.Name : "";
                node.Cells[2].Text = relationship.Path;
                return;
            }
            throw new Exception("ScriptBase Type " + scriptBase.GetType().Name + " not found");
        }
Esempio n. 21
0
 public override bool Match(ScriptBase script)
 {
     return(script.MatchTemplate(missionResultsMap) || script.MatchTemplate(checkstatusMap));
 }
 public override bool Match(ScriptBase script)
 {
     return(script.MatchTemplate(AllMatchedValues.CharacterSelectNoob));
 }
 public HighlightGenerator(ScriptBase langBase)
 {
     this.langBase = langBase ?? throw new ArgumentNullException("LangBase can't be null!");
 }
Esempio n. 24
0
        public override void OnMatched(ScriptBase script)
        {
            var waitTime = 10;

            // Resetting guest served status if applicable
            if (script.MatchTemplate(t1GuestMap))
            {
                guest1served = false;
            }
            if (script.MatchTemplate(t2GuestMap))
            {
                guest2served = false;
            }
            if (script.MatchTemplate(t3GuestMap))
            {
                guest3served = false;
            }
            if (script.MatchTemplate(t4GuestMap))
            {
                guest4served = false;
            }

            // Cursor defaults at the first girl in the leftmost list, and returns there everytime a customer is served.

            // Table 1
            if (!script.MatchTemplate(t1GuestMap) && !guest1served)
            {
                Logger.Writer("Guest arrived at Table 1, serving on him!");
                MultiplePresses.Press("DPad_Right", 1, waitTime, script);
                MultiplePresses.Press("Cross", 2, waitTime, script);
                MultiplePresses.Press("DPad_Right", 2, waitTime, script);
                MultiplePresses.Press("Cross", 2, waitTime, script);
                MultiplePresses.Press("DPad_Left", 3, waitTime, script);
                guest1served = true;
            }

            // Table 2
            if (!script.MatchTemplate(t2GuestMap) && !guest2served)
            {
                Logger.Writer("Guest arrived at Table 2, serving on him!");
                MultiplePresses.Press("DPad_Right", 1, waitTime, script);
                MultiplePresses.Press("DPad_Down", 1, waitTime, script);
                MultiplePresses.Press("Cross", 2, waitTime, script);
                MultiplePresses.Press("DPad_Right", 2, waitTime, script);
                MultiplePresses.Press("Cross", 2, waitTime, script);
                MultiplePresses.Press("DPad_Up", 1, waitTime, script);
                MultiplePresses.Press("DPad_Left", 3, waitTime, script);
                guest2served = true;
            }

            // Table 3
            if (!script.MatchTemplate(t3GuestMap) && !guest3served)
            {
                Logger.Writer("Guest arrived at Table 3, serving on him!");
                MultiplePresses.Press("DPad_Left", 1, waitTime, script);
                MultiplePresses.Press("Cross", 2, waitTime, script);
                MultiplePresses.Press("DPad_Left", 2, waitTime, script);
                MultiplePresses.Press("Cross", 2, waitTime, script);
                MultiplePresses.Press("DPad_Right", 3, waitTime, script);
                guest3served = true;
            }

            // Table 4
            if (!script.MatchTemplate(t4GuestMap) && !guest4served)
            {
                Logger.Writer("Guest arrived at Table 4, serving on him!");
                MultiplePresses.Press("DPad_Left", 1, waitTime, script);
                MultiplePresses.Press("DPad_Down", 1, waitTime, script);
                MultiplePresses.Press("Cross", 2, waitTime, script);
                MultiplePresses.Press("DPad_Left", 2, waitTime, script);
                MultiplePresses.Press("Cross", 2, waitTime, script);
                MultiplePresses.Press("DPad_Up", 1, waitTime, script);
                MultiplePresses.Press("DPad_Right", 3, waitTime, script);
                guest4served = true;
            }
        }
Esempio n. 25
0
        private void SwitchTeam(ScriptBase script, MyClub.Sim.AutomateMatch.Team team)
        {
            script.Press(new DualShockState()
            {
                Triangle = true
            });
            script.Press(new DualShockState()
            {
                DPad_Down = true
            });
            script.Press(new DualShockState()
            {
                Cross = true
            });

            /*while (!script.MatchTemplate(script.CaptureFrame(), ????, 98))
             * {
             *  Thread.Sleep(1000);
             *  Log.LogMessage(Name, "Waiting for 'Select team menu'");
             * }*/
            // TODO : CAPTURE THE PICTURE !!
            Thread.Sleep(5000);

            if (team == MyClub.Sim.AutomateMatch.Team.winTwo)
            {
                /* Select Team.win2 - Add short pause between same key */
                script.Press(new DualShockState()
                {
                    DPad_Down = true
                });
                Thread.Sleep(100);
                script.Press(new DualShockState()
                {
                    DPad_Down = true
                });
                script.Press(new DualShockState()
                {
                    Cross = true
                });
            }
            if (team == MyClub.Sim.AutomateMatch.Team.winOne)
            {
                /* Select Team.win1 - Add short pause between same key */
                script.Press(new DualShockState()
                {
                    DPad_Down = true
                });
                Thread.Sleep(100);
                script.Press(new DualShockState()
                {
                    DPad_Down = true
                });
                Thread.Sleep(100);
                script.Press(new DualShockState()
                {
                    DPad_Down = true
                });
                script.Press(new DualShockState()
                {
                    Cross = true
                });
            }
            if (team == MyClub.Sim.AutomateMatch.Team.loseTwo)
            {
                /* Select Team.lose2 - Add short pause between same key */
                script.Press(new DualShockState()
                {
                    DPad_Down = true
                });
                script.Press(new DualShockState()
                {
                    Cross = true
                });
            }
            else if (team == MyClub.Sim.AutomateMatch.Team.loseOne)
            {
                /* Select Team.lose1 - Add short pause between same key */
                script.Press(new DualShockState()
                {
                    DPad_Down = true
                });
                Thread.Sleep(100);
                script.Press(new DualShockState()
                {
                    DPad_Down = true
                });
                Thread.Sleep(100);
                script.Press(new DualShockState()
                {
                    DPad_Down = true
                });
                Thread.Sleep(100);
                script.Press(new DualShockState()
                {
                    DPad_Down = true
                });
                script.Press(new DualShockState()
                {
                    Cross = true
                });
            }

            Log.LogMessage(Name, "Switch to team " + team.ToString() + " : OK.");
        }
Esempio n. 26
0
 public override void OnMatched(ScriptBase script) => script.Press(new DualShockState()
 {
     Options = true
 });
Esempio n. 27
0
        public override void OnMatched(ScriptBase script)
        {
            MyClub.Sim.AutomateMatch.ManageTeamAction action = MyClub.Sim.AutomateMatch.Instance.ActionForManageTeam();
            switch (action)
            {
            case MyClub.Sim.AutomateMatch.ManageTeamAction.readTeamNumber:
                Log.LogMessage(Name, "Read team number.");
                Log.LogMatchTemplate(script, Name, new List <RectMap> {
                    team_WinOne_Focus, teamWinTwo_Focus, team_LoseOne_Focus, team_LoseTwo_Focus
                });

                MyClub.Sim.AutomateMatch.Team t;
                if (script.MatchTemplate(team_WinOne_Focus, 98))
                {
                    t = MyClub.Sim.AutomateMatch.Team.winOne;
                }
                else if (script.MatchTemplate(teamWinTwo_Focus, 98))
                {
                    t = MyClub.Sim.AutomateMatch.Team.winTwo;
                }
                else if (script.MatchTemplate(team_LoseOne_Focus, 98))
                {
                    t = MyClub.Sim.AutomateMatch.Team.loseOne;
                }
                else if (script.MatchTemplate(team_LoseTwo_Focus, 98))
                {
                    t = MyClub.Sim.AutomateMatch.Team.loseTwo;
                }
                else
                {
                    t = MyClub.Sim.AutomateMatch.Team.unknown;
                }
                if (t != MyClub.Sim.AutomateMatch.Team.unknown)
                {
                    MyClub.Sim.AutomateMatch.Instance.ReadTeamNumberDone(t);
                    Log.LogMessage(Name, "Read team number = " + t.ToString()); Thread.Sleep(5000);
                }
                else
                {
                    script.Press(new DualShockState()
                    {
                        Circle = true
                    });
                    Log.LogMessage(Name, "Failed to read team number.");
                }
                break;

            case MyClub.Sim.AutomateMatch.ManageTeamAction.switchTeams:
                MyClub.Sim.AutomateMatch.Team from, to;
                from = MyClub.Sim.AutomateMatch.Instance.TeamNumber;
                switch (from)
                {
                case MyClub.Sim.AutomateMatch.Team.loseOne:
                    to = MyClub.Sim.AutomateMatch.Team.loseTwo;
                    break;

                case MyClub.Sim.AutomateMatch.Team.loseTwo:
                    to = MyClub.Sim.AutomateMatch.Team.loseOne;
                    break;

                case MyClub.Sim.AutomateMatch.Team.winOne:
                    to = MyClub.Sim.AutomateMatch.Team.winTwo;
                    break;

                case MyClub.Sim.AutomateMatch.Team.winTwo:
                    to = MyClub.Sim.AutomateMatch.Team.winOne;
                    break;

                case MyClub.Sim.AutomateMatch.Team.unknown:
                default:
                    to = MyClub.Sim.AutomateMatch.Team.unknown;
                    break;
                }
                Log.LogMessage(Name, "Switch from team " + from.ToString() + " to " + to.ToString() + ".");
                SwitchTeam(script, to);
                MyClub.Sim.AutomateMatch.Instance.SwitchTeamDone();
                break;

            case MyClub.Sim.AutomateMatch.ManageTeamAction.exit:
                Log.LogMessage(Name, "Exit manage team.");
                script.Press(new DualShockState()
                {
                    Circle = true
                });
                MyClub.Sim.AutomateMatch.Instance.ExitManageTeamDone();
                break;

            case MyClub.Sim.AutomateMatch.ManageTeamAction.none:
            default:
                Log.LogMessage(Name, "No action to do.");
                break;
            }
        }
Esempio n. 28
0
 public override bool Match(ScriptBase script)
 {
     return(script.MatchTemplate(HeaderBar, 95) && script.MatchTemplate(QuickGPS, 92));
 }
 public BulkUpdateOperationDescriptor <TDocument, TPartialDocument> Script(ScriptBase script) => Assign(script, (a, v) => a._script = v);
 public override bool Match(ScriptBase script)
 {
     return(script.MatchTemplate(R_Title, 99));
 }
Esempio n. 31
0
 public override bool Match(ScriptBase script)
 {
     return(script.MatchTemplate(menuTiltleMap, 98));
 }
Esempio n. 32
0
        private void AddIndividualOptions(TreeListNode node, List<Slyce.ITemplate.IOption> options, ScriptBase iteratorObject)
        {
            if (options.Count > 0)
            {
                TreeListNode optionsNode = treeList.AppendNode(new object[] { "Options", null, null }, node);
                optionsNode.ImageIndex = optionsNode.SelectImageIndex = (int)Images.Option;
                optionsNode.Tag = options;

                foreach (Slyce.ITemplate.IOption option in options)
                {
                    object defaultValue = null;
                    bool found = false;

                    foreach (UserOption opt in iteratorObject.UserOptions)
                    {
                        if (opt.Name == option.VariableName)
                        {
                            defaultValue = opt.Value;
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        //if (option.DefaultValueIsFunction)
                        //{
                            defaultValue = GetDefaultOptionValueFromFunction(option.DefaultValue, iteratorObject);
                        //}
                        //else
                        //{
                        //    defaultValue = option.DefaultValue;
                        //}
                        iteratorObject.AddUserOption(new ArchAngel.Providers.Database.Model.UserOption(option.VariableName, option.VarType, defaultValue));
                    }
                    if (Project.MustDisplayOptionToUser(option, iteratorObject))
                    {
                        TreeListNode optionNode = treeList.AppendNode(new object[] { option.Text, defaultValue.ToString(), null }, optionsNode);
                        optionNode.Tag = option;
                        optionNode.ImageIndex = optionNode.SelectImageIndex = (int)Images.GreenBullet;
                    }
                }
            }
        }
Esempio n. 33
0
        public override void OnMatched(ScriptBase script)
        {
            var waitTime = 500;

            if (script.MatchTemplate(HinaMap, 98))
            {
                Logger.Writer("Looks like it's time for the A-Team, let's get them ready for their shift...");
                MultiplePresses.Press("Cross", 1, waitTime, script); // Selected Hina
                MultiplePresses.Press("DPad_Right", 1, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script);
                MultiplePresses.Press("DPad_Right", 1, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script); // Selected Emma
                MultiplePresses.Press("DPad_Right", 1, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script);
                MultiplePresses.Press("DPad_Right", 2, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script); // Selected Liz
                MultiplePresses.Press("DPad_Right", 1, waitTime, script);
                MultiplePresses.Press("DPad_Down", 1, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script);
                MultiplePresses.Press("DPad_Right", 3, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script); // Selected Bright
                MultiplePresses.Press("DPad_Right", 1, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script);
                MultiplePresses.Press("DPad_Down", 1, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script); // Selected Rena
                MultiplePresses.Press("DPad_Right", 1, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script);
                MultiplePresses.Press("DPad_Down", 1, waitTime, script);
                MultiplePresses.Press("DPad_Right", 1, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script); // Selected Sabrina
            }
            else
            {
                Logger.Writer("Looks like it's time for the B-Team, let's get them ready for their shift...");
                MultiplePresses.Press("DPad_Down", 1, waitTime, script);
                MultiplePresses.Press("DPad_Right", 2, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script); // Selected Jacqueline
                MultiplePresses.Press("DPad_Right", 1, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script);
                MultiplePresses.Press("DPad_Down", 1, waitTime, script);
                MultiplePresses.Press("DPad_Right", 3, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script); // Selected Susan
                MultiplePresses.Press("DPad_Right", 1, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script);
                MultiplePresses.Press("DPad_Down", 2, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script); // Selected Miriam
                MultiplePresses.Press("DPad_Right", 1, waitTime, script);
                MultiplePresses.Press("DPad_Down", 1, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script);
                MultiplePresses.Press("DPad_Down", 2, waitTime, script);
                MultiplePresses.Press("DPad_Right", 1, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script); // Selected Fan
                MultiplePresses.Press("DPad_Right", 1, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script);
                MultiplePresses.Press("DPad_Down", 2, waitTime, script);
                MultiplePresses.Press("DPad_Right", 2, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script); // Selected Jordan
                MultiplePresses.Press("DPad_Right", 1, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script);
                MultiplePresses.Press("DPad_Down", 2, waitTime, script);
                MultiplePresses.Press("DPad_Right", 3, waitTime, script);
                MultiplePresses.Press("Cross", 1, waitTime, script); // Selected Jordan
            }

            // Done! Returning to Main Menu!
            Logger.Writer("Shift staffed, returning to main menu...");
            MultiplePresses.Press("Circle", 1, waitTime, script);
            MultiplePresses.Press("DPad_Up", 1, waitTime, script);
        }
Esempio n. 34
0
        private string[] GetTreeListNodeText(ScriptBase scriptBase)
        {
            if (scriptBase.GetType() == typeof(ArchAngel.Providers.Database.Model.Table) ||
                scriptBase.GetType() == typeof(ArchAngel.Providers.Database.Model.View) ||
                scriptBase.GetType() == typeof(ArchAngel.Providers.Database.Model.StoredProcedure) ||
                scriptBase.GetType() == typeof(ArchAngel.Providers.Database.Model.Column) ||
                scriptBase.GetType() == typeof(ArchAngel.Providers.Database.Model.Filter) ||
                scriptBase.GetType() == typeof(ArchAngel.Providers.Database.Model.Index) ||
                scriptBase.GetType() == typeof(ArchAngel.Providers.Database.Model.Key))
            {
                return new string[] { scriptBase.Alias, scriptBase.Name != scriptBase.Alias ? scriptBase.Name : null, null };
            }

            if (scriptBase.GetType() == typeof(ArchAngel.Providers.Database.Model.MapColumn))
            {
                MapColumn mapColumn = (MapColumn)scriptBase;
                return new string[] { scriptBase.Alias, scriptBase.Name != scriptBase.Alias ? scriptBase.Name : null, mapColumn.ForeignColumn.Parent.Alias + "." + mapColumn.ForeignColumn.Alias };
            }

            if (scriptBase.GetType() == typeof(ArchAngel.Providers.Database.Model.OneToOneRelationship) ||
                scriptBase.GetType() == typeof(ArchAngel.Providers.Database.Model.OneToManyRelationship) ||
                scriptBase.GetType() == typeof(ArchAngel.Providers.Database.Model.ManyToOneRelationship) ||
                scriptBase.GetType() == typeof(ArchAngel.Providers.Database.Model.ManyToManyRelationship))
            {
                Relationship relationship = (Relationship)scriptBase;
                return new string[] { scriptBase.Alias, scriptBase.Name != scriptBase.Alias ? scriptBase.Name : null, relationship.Path };
            }

            throw new Exception("ScriptBase Type " + scriptBase.GetType().Name + " not found");
        }
Esempio n. 35
0
        public override void OnMatched(ScriptBase script)
        {
            var mainscript = script as Script;

            mainscript.MainForm.Log("Entered Freemode");
            script.Press(new DualShockState()
            {
                Options = true
            });
            script.Sleep(400);
            script.Press(new DualShockState()
            {
                DPad_Right = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                Cross = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                Cross = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                DPad_Down = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                Cross = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                DPad_Down = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                DPad_Down = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                DPad_Down = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                Cross = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                DPad_Down = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                DPad_Down = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                DPad_Down = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                DPad_Down = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                DPad_Down = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                DPad_Down = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                DPad_Down = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                Cross = true
            });
            script.Sleep(350);

            for (int i = 1; i <= 2; i++)
            {
                script.Press(new DualShockState()
                {
                    DPad_Down = true
                });
                script.Sleep(50);
            }
            script.Press(new DualShockState()
            {
                Cross = true
            });
            script.Sleep(350);
            script.Press(new DualShockState()
            {
                Cross = true
            });
            script.Sleep(30000);
        }
Esempio n. 36
0
 public override bool Match(ScriptBase script)
 {
     return(script.MatchTemplate(key, 50));
 }
 public override bool Match(ScriptBase script)
 {
     return(script.MatchTemplate(AllMatchedValues.KlassicDifficultyPrompt));
 }
Esempio n. 38
0
 /// <summary>
 /// Runs the plugin runner for the given script (does not accept a Window).
 /// </summary>
 /// <param name="script">The script to run. This script does not use an Eclipse-provided Window.</param>
 /// <param name="userId">The optional user ID to log in to Eclipse.</param>
 /// <param name="password">The optional user password to log in to Eclipse.</param>
 public static void Run(ScriptBase script, string userId = null, string password = null) =>
 RunWith(new PluginRunner(script, userId, password));
Esempio n. 39
0
 public override bool Match(ScriptBase script)
 {
     return(script.MatchTemplate(EndSkiesMap, 98));
 }
Esempio n. 40
0
 public SimpleData(ScriptBase script)
 {
     ExtraData = script;
 }
Esempio n. 41
0
 private void UpdateTreeListNodeText(Node treeListNode, ScriptBase scriptBase)
 {
     GetTreeListNodeText(scriptBase, treeListNode);
     treeListNode.Tag = scriptBase;
 }