Beispiel #1
0
 public static void Start()
 {
     RuntimeObject.Init();
     RigidBody.Init();
     CollisionBody.Init();
     CollisionSensor.Init();
     TransportSurface.Init();
     CollisionMaterial.Init();
     HingeJoint.Init();
     SlidingJoint.Init();
     CylindricalJoint.Init();
     FixedJoint.Init();
     BallJoint.Init();
     AngularLimit.Init();
     LinearLimit.Init();
     AngularSpring.Init();
     LinearSpring.Init();
     SpeedControl.Init();
     PositionControl.Init();
     BreakingConstraint.Init();
     GearCoupling.Init();
     CamCoupling.Init();
     ElecCamCoupling.Init();
     PreventCollision.Init();
     ChangeMaterial.Init();
     ComponentPart.Init();
     SourceBehavior.Init();
     SinkBehavior.Init();
     GraphControl.Init();
     ExternalConnection.Init();
     SignalAdapter.Init();
     Signal.Init();
     ProxyObject.Init();
     RuntimeParameters.Init();
 }
        public static int Main(string [] args)
        {
            // Create a new RuntimeParameters to parse the args
            RuntimeParameters parameters = new RuntimeParameters(
                "HelloWorldNodeDataHandler",
                "HelloWorld using IDataHandler/ISender paradigm");

            // Parse the args, if we don't get 0 back, there was an error
            if (parameters.Parse(args) != 0)
            {
                // Print the error and help
                Console.WriteLine(parameters.ErrorMessage);
                parameters.ShowHelp();
                // exit after error
                return(-1);
            }
            else if (parameters.Help)
            {
                // Caller asked for help, let's print it
                parameters.ShowHelp();
                // exit after printing help
                return(0);
            }

            // Instantiate a new inherited node of your choice
            HelloWorldNodeDataHandler hwn =
                new HelloWorldNodeDataHandler(parameters.NodeConfig);

            // And run it... this hijacks the current thread, we'll return once the node disconnects
            hwn.Run();

            Console.WriteLine("Exiting...");

            return(0);
        }
    public static string[] GetImageDependencies(AbilityDataSubclass[] target)
    {
        HashSet <string> imageDependencies = new HashSet <string>();

        for (int i = 0; i < target.Length; i++)
        {
            for (int j = 0; j < target[i].var.Length; j++)
            {
                if (LoadedData.GetVariableType(target[i].classType, j, VariableTypes.IMAGE_DEPENDENCY))
                {
                    RuntimeParameters <string> imagePath = target[i].var[j].field as RuntimeParameters <string>;

                    if (!imageDependencies.Contains(imagePath.v))
                    {
                        imageDependencies.Add(imagePath.v);
                    }
                }
            }
        }

        string[] sArray = new string[imageDependencies.Count];
        int      index  = 0;

        foreach (string path in imageDependencies)
        {
            sArray[index] = path;
            index++;
        }

        return(sArray);
        //return imageDependencies.ToArray();
    }
    public void RunAccordingToGeneric <T, P>(P arg)
    {
        int subclass = ((int[])(object)arg)[0];
        int oldId    = ((int[])(object)arg)[1];
        int newId    = ((int[])(object)arg)[2];

        RuntimeParameters <T> rP = null;

        try {
            rP = JsonConvert.DeserializeObject <RuntimeParameters <T> >(standardFiles[subclass].rP[oldId]);
        } catch (Exception e) {
            Debug.Log("Could not convert. Reverting to source.");
        }

        int[][] links = JsonConvert.DeserializeObject <int[][]>(standardFiles[subclass].l[oldId]);

        if (rP != null)
        {
            convertedFormat[subclass].var[newId] = new Variable(rP, links);
        }
        else
        {
            convertedFormat[subclass].var[newId] = new Variable(LoadedData.loadedParamInstances[convertedFormat[subclass].classType].runtimeParameters[newId].rP, links);
        }
    }
Beispiel #5
0
        private void Vision_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!normalExit)
            {
                if (!mainForm.RecipeChangeover)
                {
                    if (DialogResult.Yes == MessageBox.Show("Save changes?", "Save?", MessageBoxButtons.YesNo))
                    {
                        saveParameters = true;
                    }
                }
            }

            if (saveParameters)
            {
                mainForm.SerializeRuntimeParameters(runtimeParameters);
            }
            else
            {
                // Reload the recipe
                bool success;
                restoreParameters = mainForm.DeserializeRuntimeParamters(mainForm.RecipeName + ".xml", out success);
                if (!success)
                {
                    MessageBox.Show("Error reading recipe file.", "Warning!");
                    return;
                }
            }
        }
Beispiel #6
0
        public void Initialize(PatternDefinition def)
        {
            definition = def;
            Debug.Log("Starting Pattern: " + definition.name);
            runParams = new RuntimeParameters()
            {
                rotationSpeed = def.rotationSpeed
            };

            // Spawn Points
            GameObject pointsParentGo = new GameObject("AttackPoints Root");

            runParams.pointsParent = pointsParentGo.transform;
            runParams.pointsParent.SetParent(transform);
            runParams.attackPoints = definition.CreateSpawnPoints(runParams.pointsParent);

            // Sequence
            procManager     = new ProcessManager();
            sequenceProcess = new SequenceProcess(definition.sequence, runParams, definition.finishedDelay);
            sequenceProcess.TerminateCallback += SequenceFinished;
            procManager.LaunchProcess(sequenceProcess);

            // Simultaneous Patterns
            foreach (PatternDefinition defSimult in definition.simultaneous)
            {
                defSimult.Attach(gameObject).suppressNext = true;
            }
        }
    public override SpawnerOutput ReturnCustomUI(int variable, RuntimeParameters rp)
    {
        int p = GetVariableId("Point");

        if (p == variable)
        {
            SpawnerOutput pField           = LoadedData.GetSingleton <UIDrawer>().CreateScriptedObject(typeof(DropdownWrapper));
            Dropdown      dW               = LoadedData.GetSingleton <UIDrawer>().GetTypeInElement <Dropdown>(pField);
            List <Dropdown.OptionData> dOd = new List <Dropdown.OptionData>();
            RuntimeParameters <int>    rpI = rp as RuntimeParameters <int>;

            dOd.Add(new Dropdown.OptionData("X"));
            dOd.Add(new Dropdown.OptionData("Y"));

            dW.AddOptions(dOd);

            dW.value = rpI.v;

            dW.onValueChanged.AddListener((id) => {
                rpI.v = id;
            });

            return(pField);
        }

        return(base.ReturnCustomUI(variable, rp));
    }
Beispiel #8
0
        static void Main(string[] p_Args)
        {
            RuntimeParameters runtimeParameters = new RuntimeParameters();

            var optionSet = new OptionSet {
                { "d|directory-path=", "Absolute path to the repository to update.", value => runtimeParameters.DirectoryPath = value },
                { "u|hosting-username="******"Username used with the hosting platform.", value => runtimeParameters.Username = value },
                { "p|hosting-password="******"Password used with the hosting platform.", value => runtimeParameters.Password = value },
                { "h|help", "Show this message", value => runtimeParameters.Help = value != null }
            };

            try {
                optionSet.Parse(p_Args);
            } catch (OptionException e) {
                s_Logger.Error(e.Message);
                s_Logger.Info("Try `--help` for more information.");
                return;
            }

            if (runtimeParameters.Help)
            {
                ShowHelp(optionSet);
                return;
            }

            if (!runtimeParameters.Validate())
            {
                s_Logger.Error("Invalid arguments.");
                s_Logger.Info("Try `--help` for more information.");
                return;
            }

            Run(runtimeParameters);
        }
Beispiel #9
0
        private Nar(CompoundAndTermContext compoundAndTermContext, RuntimeParameters runtimeParameters)
        {
            Memory m = createMemory(compoundAndTermContext, runtimeParameters);

            this.memory = m;
            this.param  = runtimeParameters;
        }
Beispiel #10
0
        public Stats(MainForm mf, RuntimeParameters rp)
        {
            InitializeComponent();

            mainForm          = mf;
            runtimeParameters = rp;
        }
Beispiel #11
0
 public Engineering(AbbCom.Client lc, MachineConfig mc, RuntimeParameters rp, MainForm mf)
 {
     logClient         = lc;
     machineParameters = mc;
     runtimeParameters = rp;
     mainForm          = mf;
     InitializeComponent();
 }
Beispiel #12
0
    public override void NodeCallback()
    {
        base.NodeCallback();

        int[]             arrayValues = GetCentralInst().GetVariableLinks(0, GetNodeId(), GetVariableId("Values"))[GetNodeVariable <int>("Array Element")];
        RuntimeParameters targetVar   = GetCentralInst().ReturnRuntimeParameter(arrayValues[0], arrayValues[1]);

        targetVar.RunGenericBasedOnRP <RuntimeParameters>(this, targetVar);
    }
Beispiel #13
0
        public AcqFifoAdjust(MainForm mf, RuntimeParameters rp, CogJobManager cjm)
        {
            InitializeComponent();

            mainForm          = mf;
            runtimeParameters = rp;
            restoreParameters = rp.ShallowCopy();
            mcjmAcq           = cjm;
        }
Beispiel #14
0
        public void MaliciousRuntimeParametersAreDenied()
        {
            RuntimeParameters maliciousConfig = new RuntimeParameters {
                DirectoryPath = "rm -rf",
                Username      = "******",
                Password      = "******"
            };

            Assert.False(maliciousConfig.Validate());
        }
Beispiel #15
0
        public Vision(MainForm mf, RuntimeParameters rp, CogJobManager cjm, MachineConfig mc)
        {
            InitializeComponent();

            mainForm          = mf;
            runtimeParameters = rp;
            machineParameters = mc;
            restoreParameters = rp.ShallowCopy();
            mcjmAcq           = cjm;
        }
Beispiel #16
0
        private static void Run(RuntimeParameters p_RuntimeParameters)
        {
            NureOptions nureOptions;

            try {
                TextReader json = File.OpenText(Path.Combine(p_RuntimeParameters.DirectoryPath, CONFIGURATION_FILE_NAME));
                nureOptions = JsonSerializer.CreateDefault().Deserialize <NureOptions>(new JsonTextReader(json));
                s_Logger.Info("Launching NuRe with the following configuration:\n" + nureOptions);
            } catch (FileNotFoundException exception) {
                s_Logger.Error($"Could not locate the file. {exception.Message}");
                return;
            }

            var    gitWrapper = new GitAgent(nureOptions.CommitMessage);
            string remoteName = "origin";
            string branchName;

            try {
                gitWrapper.CreateRepository(p_RuntimeParameters.DirectoryPath);
                gitWrapper.Fetch(p_RuntimeParameters, remoteName, nureOptions.HostingUrl);
                branchName = gitWrapper.SetupBranch(nureOptions.NureBranchPrefix, remoteName);
            } catch (LibGit2SharpException exception) {
                s_Logger.Error($"Could not setup the branch. {exception.Message}");
                return;
            } catch (InvalidProgramException exception) {
                s_Logger.Error($"Could not create the repository. {exception.Message}");
                return;
            } catch (UriFormatException exception) {
                s_Logger.Error($"Could not fetch the repository. Hosting Url: {nureOptions.HostingUrl}. {exception.Message}");
                return;
            }

            NuKeeperWrapper nukeeper = new NuKeeperWrapper(nureOptions, p_RuntimeParameters.DirectoryPath);

            nukeeper.Run();
            s_Logger.Info("Run Complete");

            gitWrapper.Stage();
            //todo get them from the options file
            Identity  identity  = new Identity("Jenkins", "*****@*****.**");
            Signature signature = new Signature(identity, DateTimeOffset.Now);

            try {
                gitWrapper.Commit(signature);
                gitWrapper.Push(p_RuntimeParameters);
            } catch (LibGit2SharpException exception) {
                s_Logger.Error($"Could not setup the branch. {exception.Message}");
                return;
            }

            var pullRequestWriterFactory = new PullRequestWriterFactory(nureOptions, p_RuntimeParameters.Username, p_RuntimeParameters.Password);

            pullRequestWriterFactory.Create().WritePullRequest(branchName);
        }
Beispiel #17
0
        static void Main(string[] args)
        {
            var runtimeParameters  = new RuntimeParameters(args);
            var environmentContext = new EnvironmentContext(runtimeParameters);
            var globalContext      = new GlobalContext(environmentContext);
            var processor          = new LocationProcessor(globalContext);

            processor.Process();

            Console.ReadLine();
        }
Beispiel #18
0
        static Memory createMemory(CompoundAndTermContext compoundAndTermContext, RuntimeParameters runtimeParameters)
        {
            IAttentionMechanism <ClassicalTask> attentionMechanism = new BagBasedAttentionMechanism();

            attentionMechanism.setMaxSize(Parameters.NOVEL_TASK_BAG_SIZE);

            return(new Memory(
                       compoundAndTermContext,
                       runtimeParameters,
                       attentionMechanism
                       //commented because OpenNARS version   new ArrayBag<>(Parameters.SEQUENCE_BAG_LEVELS, Parameters.SEQUENCE_BAG_SIZE)
                       ));
        }
Beispiel #19
0
    public override SpawnerOutput ReturnCustomUI(int variable, RuntimeParameters rp)
    {
        if (variable == GetVariableId("Input Key"))
        {
            KeyCodeDropdownList kcDdL = new KeyCodeDropdownList((rp as RuntimeParameters <int>).v);

            kcDdL.ReturnDropdownWrapper().dropdown.onValueChanged.AddListener((v) => {
                (rp as RuntimeParameters <int>).v = KeyCodeDropdownList.inputValues[v];
            });

            return(kcDdL.dW);
        }

        return(base.ReturnCustomUI(variable, rp));
    }
Beispiel #20
0
        public void Push(RuntimeParameters p_Parameters)
        {
            s_Logger.Info($"Pushing {m_BranchName}.");
            PushOptions options = new PushOptions {
                CredentialsProvider = (url,
                                       usernameFromUrl,
                                       types) =>
                                      new UsernamePasswordCredentials {
                    Username = p_Parameters.Username, Password = p_Parameters.Password
                }
            };

            m_Repository.Network.Push(m_Repository.Branches[m_BranchName], options);
            s_Logger.Info("Push Complete.");
        }
Beispiel #21
0
        public void MissingRuntimeParametersAreDetected()
        {
            var missingPassword = new RuntimeParameters {
                DirectoryPath = "/bin/bash", Username = "******"
            };
            var missingPath = new RuntimeParameters {
                Username = "******", Password = "******"
            };
            var missingUser = new RuntimeParameters {
                DirectoryPath = "/bin/bash", Password = "******"
            };

            Assert.False(missingPassword.Validate());
            Assert.False(missingPath.Validate());
            Assert.False(missingUser.Validate());
        }
Beispiel #22
0
        private void buttonPatternParams_Click(object sender, EventArgs e)
        {
            bool success;

            runtimeParameters = mainForm.DeserializeRuntimeParamters(mainForm.RecipeName + ".xml", out success);
            if (!success)
            {
                MessageBox.Show("Error reading 'runtimeParameters' file.", "Warning!");
                return;
            }

            using (PatternParams ca = new PatternParams(mainForm, runtimeParameters, machineParameters, mcjmAcq))
            {
                ca.ShowDialog();
            }
        }
Beispiel #23
0
        private void buttonGreyscaleAdvanced_Click(object sender, EventArgs e)
        {
            bool success;

            runtimeParameters = mainForm.DeserializeRuntimeParamters(mainForm.RecipeName + ".xml", out success);
            if (!success)
            {
                MessageBox.Show("Error reading 'runtimeParameters' file.", "Warning!");
                return;
            }

            using (AcqFifoAdjust acq = new AcqFifoAdjust(mainForm, runtimeParameters, mcjmAcq))
            {
                acq.ShowDialog();
            }
        }
        /// <summary>
        /// Setup the operating environment
        /// </summary>
        /// <param name="environment">Environment to process within.</param>
        private void SetEnvironmentContext(RuntimeParameters runtimeParameters)
        {
            _environment   = !string.IsNullOrWhiteSpace(runtimeParameters.Environment) ? runtimeParameters.Environment : "local";
            _indexLanguage = !string.IsNullOrWhiteSpace(runtimeParameters.IndexLanguage) ? runtimeParameters.IndexLanguage : "en";
            _build         = runtimeParameters.Build;

            SetSqlEnvironments();
            SetCountriesToBeIndexed();
            SetLanguageCodes();
            SetIndexName();
            SetXmlDocumentsDestinationPath();

            //SetElasticsearchConnString(environment);
            //SetShardsReplicasValues(environment);
            //SetDocumentPartitionTargetSizeMultiplier(environment);
        }
Beispiel #25
0
    public static RuntimeParameters[] ReturnNodeVariables(Type nodeT)
    {
        if (loadedParamInstances.ContainsKey(nodeT))
        {
            RuntimeParameters[] rP = new RuntimeParameters[loadedParamInstances[nodeT].runtimeParameters.Length];

            for (int i = 0; i < rP.Length; i++)
            {
                rP[i] = loadedParamInstances[nodeT].runtimeParameters[i].rP;
            }

            return(rP);
        }

        return(null);
    }
Beispiel #26
0
        public Memory(
            CompoundAndTermContext compoundAndTermContext,
            RuntimeParameters runtimeParameters,
            IAttentionMechanism <ClassicalTask> attention
            )
        {
            this.compoundAndTermContext = compoundAndTermContext;
            this.param     = runtimeParameters;
            this.attention = attention;

            conceptProcessing = new ClassicalConceptProcessing(this, compoundAndTermContext);

            workingCyclish          = new WorkingCyclish();
            workingCyclish.concepts = new ArrayBag <ClassicalConcept, TermOrCompoundTermOrVariableReferer>();
            workingCyclish.concepts.setMaxSize(Parameters.CONCEPT_BAG_SIZE);
        }
Beispiel #27
0
        private void Engineering_Load(object sender, EventArgs e)
        {
            bool success;

            runtimeParameters = mainForm.DeserializeRuntimeParamters(mainForm.RecipeName + ".xml", out success);
            if (!success)
            {
                MessageBox.Show("Error reading recipe file.", "Warning!");
                return;
            }

            if (logClient.Running)
            {
                buttonStartLogger.Enabled = false;
                buttonStopLogger.Enabled  = true;
                buttonSend.Enabled        = true;
            }
            else
            {
                buttonStartLogger.Enabled = true;
                buttonStopLogger.Enabled  = false;
                buttonSend.Enabled        = false;
            }

            textBoxCogJobBlob.Text    = runtimeParameters.VisCogJobBlobName;
            textBoxCogJobPattern.Text = runtimeParameters.VisCogJobPatternName;
            lastBlobName                 = textBoxCogJobBlob.Text;
            lastPatternName              = textBoxCogJobPattern.Text;
            textBoxCogJobBlob.Enabled    = false;
            textBoxCogJobPattern.Enabled = false;
            buttonSave.Enabled           = false;
            groupBoxDataLogger.Enabled   = false;
            checkBoxCogJobEnable.Enabled = false;

            if (mainForm.GetUserAccountLevel(mainForm.CurrentLoggedOnUser) >= 3)
            {
                groupBoxDataLogger.Enabled   = true;
                checkBoxCogJobEnable.Enabled = true;
            }

            // Disable certain items if vision is online
            if (mainForm.VisionOnline)
            {
                checkBoxCogJobEnable.Enabled = false;
            }
        }
Beispiel #28
0
    public override void ThreadZeroed(int parentThread)
    {
        base.ThreadZeroed(parentThread);

        AbilityCentralThreadPool centralInst = GetCentralInst();

        int[][] variableLinks = centralInst.GetVariableLinks(0, GetNodeId(), GetVariableId("Return from Variable"));
        if (variableLinks.Length == 0)
        {
            return;
        }

        int[] modifiedReturn = variableLinks[0];

        returnTargetInst = centralInst.ReturnRuntimeParameter(modifiedReturn[0], modifiedReturn[1]);
        returnTargetInst.RunGenericBasedOnRP <int>(this, parentThread);
        threadMap.Remove(parentThread);
    }
Beispiel #29
0
        public void Fetch(RuntimeParameters p_Parameters,
                          string p_RemoteName,
                          string p_HostingUrl)
        {
            FetchOptions options = new FetchOptions {
                CredentialsProvider = (url,
                                       usernameFromUrl,
                                       types) =>
                                      new UsernamePasswordCredentials {
                    Username = p_Parameters.Username, Password = p_Parameters.Password
                }
            };

            var remote = m_Repository.Network.Remotes[p_RemoteName];

            s_Logger.Debug($"Remote Url remote: {remote.Url}");
            var refSpecs = remote.FetchRefSpecs.Select(x => x.Specification);

            Commands.Fetch(m_Repository, remote.Name, refSpecs, options, "Fetching the latest changes.");
        }
    /*public void CreateAbilityNetworkData() {
     *  AbilityCentralThreadPool centralPool = new AbilityCentralThreadPool(playerId);
     *  SignalCentralCreation(centralPool);
     *  CreateAbility(centralPool, ClientProgram.clientId);
     * }*/


    public void CreateAbility(AbilityCentralThreadPool threadInst,int pId,int givenPopulatedId = -1)
    {
        if (givenPopulatedId > -1)
        {
            AbilitiesManager.aData[pId].playerSpawnedCentrals.ModifyElementAt(givenPopulatedId,threadInst);
        }
        else
        {
            givenPopulatedId = AbilitiesManager.aData[pId].InsertSpawnedIntoFreeSpace(threadInst);//AbilityCentralThreadPool.globalCentralList.Add(threadInst);
        }
        //int nId = AbilityTreeNode.globalList.Add(new AbilityNodeHolder(tId.ToString(), a));
        //Variable[][] clonedCopy = CloneRuntimeParams(dataVar);

        RuntimeParameters[][] clonedRp = new RuntimeParameters[dataVar.Length][];
        int[][][][][]         linkMap  = new int[1][][][][];
        linkMap[0] = new int[dataVar.Length][][][];

        for (int i = 0; i < dataVar.Length; i++)
        {
            clonedRp[i]   = new RuntimeParameters[dataVar[i].Length];
            linkMap[0][i] = new int[dataVar[i].Length][][];

            for (int j = 0; j < dataVar[i].Length; j++)
            {
                clonedRp[i][j]   = dataVar[i][j].field.ReturnNewRuntimeParamCopy();
                linkMap[0][i][j] = dataVar[i][j].links;
            }
        }


        //Debug.Log(boolData.OutputValues());
        bool[][] clonedBoolValues = boolData.ReturnNewCopy();

        threadInst.SetCentralData(pId,givenPopulatedId,clonedRp,generatedLinks,dataType,nodeBranchingData,clonedBoolValues,autoManagedVariables,targettedNodes,nodeNetworkVariables);

        //if(startThreads)
        //    threadInst.StartThreads();
        //threadInst.SendVariableNetworkData();
    }