internal void Foo(ParamType param)
        {
            var local = new LocalType();

            CreateReturnType().Foo().Bar();
            Fum();
        }
Example #2
0
        /// <summary>
        /// Push current item onto the stack without affecting Location.
        /// </summary>
        public void PushValue()
        {
            switch (_storage.Location)
            {
            case ItemLocation.Stack:
                _helper.Emit(OpCodes.Dup);
                break;

            case ItemLocation.Parameter:
                _helper.LoadParameter(_storage.ParameterLocation);
                break;

            case ItemLocation.Local:
                _helper.Emit(OpCodes.Ldloc, _storage.LocalLocation !);
                break;

            case ItemLocation.Current:
                _helper.Emit(OpCodes.Ldloca, _storage.CurrentLocation !);
                _helper.Call(_storage.CurrentLocation !.LocalType.GetMethod("get_Current") !);
                break;

            default:
                Debug.Fail($"Invalid location: {_storage.Location}");
                break;
            }
        }
Example #3
0
        /// <summary>
        /// Builds an MethodCall using IMethodCallMessage.
        /// </summary>
        /// <param name="msg">Information, to create a MethodCallRequest</param>
        /// <returns>A new instance of methodCallrequest</returns>
        private MethodCallMessage ToMethodCallRequest(IMethodCallMessage msg)
        {
            Guid id = Guid.NewGuid();

            string methodName = msg.MethodName;
            Dictionary <string, string> metaData = new Dictionary <string, string>();

            // The structure is always domain.DOMAINTYPE.events
            metaData.Add("serviceId", "domain." + DomainName + ".events");

            // Arbitrary string, maybe not necessary
            metaData.Add("contextId", ContextId);
            List <string> classes = new List <string>();

            foreach (object arg in msg.Args)
            {
                if (arg != null)
                {
                    LocalType type = new LocalType(arg.GetType());
                    classes.Add(type.RemoteTypeFullName);
                }
                else
                {
                    classes.Add(null);
                }
            }

            RemoteMethodCall call             = RemoteMethodCall.CreateInstance(methodName, msg.Args, metaData, classes, null);
            BeanDescription  authentification = BeanDescription.CreateInstance(AuthenificationClass);

            authentification.Data.Add("value", Password);
            MethodCallMessage message = MethodCallMessage.CreateInstance(Username, authentification, call, id.ToString(), true, String.Empty);

            return(message);
        }
Example #4
0
    public override void Load(XmlNode xnode)
    {
        type = LocalType.Get(xnode.Name);

        texture = new Texture();
        name = MyXml.GetString(xnode, "name");
        variations = MyXml.GetInt(xnode, "variations", 1);
        maxHP = MyXml.GetInt(xnode, "hp");
        damage = MyXml.GetInt(xnode, "damage");
        attack = MyXml.GetInt(xnode, "attack");
        defence = MyXml.GetInt(xnode, "defence");
        armor = MyXml.GetInt(xnode, "armor");
        movementTime = MyXml.GetFloat(xnode, "movementTime");
        attackTime = MyXml.GetFloat(xnode, "attackTime");
        isWalkable = MyXml.GetBool(xnode, "walkable");
        isFlat = MyXml.GetBool(xnode, "flat");

        if (xnode.Name == "Thing") isWalkable = true;

        string s = MyXml.GetString(xnode, "type");
        if (s != "") creatureType = CreatureType.Get(s);

        s = MyXml.GetString(xnode, "corpse");
        if (creatureType != null && (creatureType.name == "Animal" || creatureType.name == "Sentient")) s = "Blood";
        if (s != "") corpse = Get(s);

        s = MyXml.GetString(xnode, "onDeath");
        if (creatureType != null && creatureType.name == "Animal") s = "Large Chunk of Meat";
        if (s != "") onDeath = ItemShape.Get(s);

        for (xnode = xnode.FirstChild; xnode != null; xnode = xnode.NextSibling)
            abilities.Add(BigBase.Instance.abilities.Get(MyXml.GetString(xnode, "name")));
    }
Example #5
0
        public void TestIfRemoteFromAnnotiationInAMethodIsInJavaValid()
        {
            Type      testClassType = typeof(TestClassLocalTypeWithLessMethods);
            LocalType lt            = new LocalType(testClassType);

            Assert.AreEqual <String>(lt.RemoteTypeFullName, "org.test.domain.example." + testClassType.Name);
        }
Example #6
0
 public async Task <IActionResult> Patch([FromBody] LocalType feedbackType)
 {
     if (feedbackType != null)
     {
         return(Ok(await feedbackType.Update()));
     }
     return(BadRequest("Parameters are null"));
 }
 public async Task <IActionResult> Post([FromBody] LocalType localType)
 {
     if (localType != null)
     {
         return(Ok(await localType.Add()));
     }
     return(BadRequest("Parameters are null"));
 }
Example #8
0
 /// <summary>
 /// ToString()
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     if (IsPinned)
     {
         return(LocalType.ToString() + " (" + LocalIndex.ToString() + ") (pinned)");
     }
     return(LocalType.ToString() + " (" + LocalIndex.ToString() + ")");
 }
        public override string ToString()
        {
            string toString = LocalType.ToString() + " (" + LocalIndex + ")";

            if (IsPinned)
            {
                toString += " (pinned)";
            }

            return(toString);
        }
Example #10
0
        public LocalVariable(string name, LexicalScope parentScope, IChelaType type, bool pseudoLocal)
            : base(type, parentScope.GetModule())
        {
            base.SetName(name);
            this.parentScope = parentScope;

            // Add the variable into this.
            this.isPseudoLocal = pseudoLocal;
            this.index = parentScope.AddLocal(this);
            this.argumentIndex = -1;
            this.position = null;

            // Check for generated locals.
            if(name.StartsWith("._gsym"))
                localType = LocalType.Generated;
        }
Example #11
0
        public Tools()
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;

            Assembly[] LocalAssemblies = currentDomain.GetAssemblies();

            foreach (Assembly LocalAssembly in LocalAssemblies)
            {
                foreach (Type LocalType in LocalAssembly.GetTypes())
                {
                    if (LocalType.IsSubclassOf(typeof(Base)))
                    {
                        this.LangTypes.Add(LocalType);
                    }
                }
            }
        }
Example #12
0
        /// <summary>
        /// Creates an Proxy on the bus.
        /// </summary>
        public override void CreateRemoteProxy()
        {
            Logger.Info("Create a new connector");
            IDictionary <string, string> metaData = new Dictionary <string, string>();

            metaData.Add("serviceId", CreationServiceId);
            metaData.Add("contextId", ContextId);
            RegisterId = ConnectorId;

            IList <string> classes   = new List <string>();
            LocalType      localType = new LocalType(typeof(String));

            classes.Add(localType.RemoteTypeFullName);
            classes.Add("org.openengsb.core.api.model.ConnectorDescription");

            IList <object> args = new List <object>();

            Org.Openengsb.Loom.CSharp.Bridge.OpenEngSB300.Remote.RemoteObjects.ConnectorDescription connectorDescription = new Org.Openengsb.Loom.CSharp.Bridge.OpenEngSB300.Remote.RemoteObjects.ConnectorDescription();
            connectorDescription.Attributes.Add("serviceId", ConnectorId);
            connectorDescription.Attributes.Add("portId", CreationPort);
            connectorDescription.Attributes.Add("destination", Destination);
            connectorDescription.ConnectorType = CreationConnectorType;
            connectorDescription.DomainType    = DomainName;

            args.Add(RegisterId);
            args.Add(connectorDescription);

            RemoteMethodCall creationCall = RemoteMethodCall.CreateInstance(CreationMethodName, args, metaData, classes, null);

            JmsDestination destinationinfo = new JmsDestination(Destination);

            destinationinfo.Queue = CreationQueue;
            String          id      = Guid.NewGuid().ToString();
            BeanDescription autinfo = BeanDescription.CreateInstance(AuthentificationClass);

            autinfo.Data.Add("value", Password);
            MethodCallMessage secureRequest = MethodCallMessage.CreateInstance(Username, autinfo, creationCall, id, true, String.Empty);
            IOutgoingPort     portOut       = new JmsOutgoingPort(destinationinfo.FullDestination, ExceptionHandler, ConnectorId);
            string            request       = Marshaller.MarshallObject(secureRequest);

            portOut.Send(request, id);
            WaitAndCheckAnswer(destinationinfo, id);
            RegistrationProcess = ERegistration.CREATED;
            portOut.Close();
            Logger.Info("Create done");
        }
Example #13
0
        /// <summary>
        /// Connect a connector to xlink
        /// </summary>
        /// <param name="ServiceId"></param>
        /// <param name="hostId"></param>
        /// <param name="toolName"></param>
        /// <param name="modelsToViews"></param>
        /// <returns></returns>
        public override XLinkUrlBlueprint ConnectToXLink(string toolName, String hostId, ModelToViewsTuple[] modelsToViews)
        {
            Logger.Info("Create a Xlink connector");
            IDictionary <string, string> metaData = new Dictionary <string, string>();

            metaData.Add("serviceId", CreationServiceId);
            metaData.Add("contextId", ContextId);

            IList <string> classes   = new List <string>();
            LocalType      localType = new LocalType(typeof(String));

            classes.Add(localType.RemoteTypeFullName);
            classes.Add(localType.RemoteTypeFullName);
            classes.Add(localType.RemoteTypeFullName);
            localType = new LocalType(modelsToViews.GetType());
            classes.Add(localType.RemoteTypeFullName);

            IList <object> args = new List <object>();

            args.Add(RegisterId);
            args.Add(hostId);
            args.Add(toolName);
            args.Add(modelsToViews);

            RemoteMethodCall creationCall = RemoteMethodCall.CreateInstance(XlinkMethodName, args, metaData, classes, null);

            JmsDestination destinationinfo = new JmsDestination(Destination);

            destinationinfo.Queue = CreationQueue;
            String          id      = Guid.NewGuid().ToString();
            BeanDescription autinfo = BeanDescription.CreateInstance(AuthentificationClass);

            autinfo.Data.Add("value", Password);
            MethodCallMessage methodCall = MethodCallMessage.CreateInstance(Username, autinfo, creationCall, id, true, String.Empty);
            IOutgoingPort     portOut    = new JmsOutgoingPort(destinationinfo.FullDestination, ExceptionHandler, ConnectorId);
            string            request    = Marshaller.MarshallObject(methodCall);

            portOut.Send(request, id);
            portOut.Close();
            MethodResultMessage result = WaitAndCheckAnswer(destinationinfo, id);

            RegistrationProcess = ERegistration.XLINK;
            Logger.Info("Create done");
            return(Marshaller.UnmarshallObject <XLinkUrlBlueprint>(result.Result.Arg.ToString()));
        }
Example #14
0
        /// <summary>
        /// Creates an Proxy on the bus.
        /// </summary>
        public override void UnRegisterConnector()
        {
            if (!RegistrationProcess.Equals(ERegistration.REGISTERED))
            {
                return;
            }

            Logger.Info("Unregister the connector with ID: " + ConnectorId);
            IDictionary <string, string> metaData = new Dictionary <string, string>();

            metaData.Add("serviceId", CreationRegistration);
            metaData.Add("contextId", ContextId);
            LocalType      localType = new LocalType(typeof(String));
            IList <string> classes   = new List <string>();

            classes.Add(localType.RemoteTypeFullName);

            IList <object> args = new List <object>();

            args.Add(ConnectorId);

            RemoteMethodCall creationCall = RemoteMethodCall.CreateInstance(UnregistrationMethodName, args, metaData, classes, null);

            JmsDestination destinationinfo = new JmsDestination(Destination);

            destinationinfo.Queue = CreationQueue;

            BeanDescription autinfo = BeanDescription.CreateInstance(AuthentificationClass);

            autinfo.Data.Add("value", Password);
            String            id            = Guid.NewGuid().ToString();
            MethodCallMessage secureRequest = MethodCallMessage.CreateInstance(Username, autinfo, creationCall, id, true, String.Empty);
            IOutgoingPort     portOut       = new JmsOutgoingPort(destinationinfo.FullDestination, ExceptionHandler, ConnectorId);
            string            request       = Marshaller.MarshallObject(secureRequest);

            portOut.Send(request, id);
            WaitAndCheckAnswer(destinationinfo, id);
            if (RegistrationProcess.Equals(ERegistration.REGISTERED))
            {
                RegistrationProcess = ERegistration.CREATED;
            }

            portOut.Close();
            Logger.Info("Unregister done");
        }
Example #15
0
        public LocalVariable(string name, LexicalScope parentScope, IChelaType type, bool pseudoLocal)
            : base(type, parentScope.GetModule())
        {
            base.SetName(name);
            this.parentScope = parentScope;

            // Add the variable into this.
            this.isPseudoLocal = pseudoLocal;
            this.index         = parentScope.AddLocal(this);
            this.argumentIndex = -1;
            this.position      = null;

            // Check for generated locals.
            if (name.StartsWith("._gsym"))
            {
                localType = LocalType.Generated;
            }
        }
Example #16
0
        /// <summary>
        /// Disconnect the Connector from XLink
        /// </summary>
        public override void DisconnectFromXLink(String hostId)
        {
            Logger.Info("Disconnect connector from xlink with the serviceId: " + ConnectorId);
            IDictionary <string, string> metaData = new Dictionary <string, string>();

            metaData.Add("serviceId", CreationServiceId);
            metaData.Add("contextId", ContextId);
            LocalType      localType = new LocalType(typeof(String));
            IList <String> classes   = new List <String>();

            classes.Add(localType.RemoteTypeFullName);
            classes.Add(localType.RemoteTypeFullName);
            IList <object> args = new List <object>();

            args.Add(RegisterId);
            args.Add(hostId);

            RemoteMethodCall deletionCall = RemoteMethodCall.CreateInstance(RemoveXlinkConnectorMethodName, args, metaData, classes, null);

            String          id = Guid.NewGuid().ToString();
            BeanDescription authentification = BeanDescription.CreateInstance(AuthentificationClass);

            authentification.Data.Add("value", Password);
            MethodCallMessage callRequest = MethodCallMessage.CreateInstance(Username, authentification, deletionCall, id, true, String.Empty);

            JmsDestination destinationinfo = new JmsDestination(Destination);

            destinationinfo.Queue = CreationQueue;

            IOutgoingPort portOut = new JmsOutgoingPort(destinationinfo.FullDestination, ExceptionHandler, ConnectorId);
            string        request = Marshaller.MarshallObject(callRequest);

            portOut.Send(request, id);
            WaitAndCheckAnswer(destinationinfo, id);
            portOut.Close();
            RegistrationProcess = ERegistration.REGISTERED;
            Logger.Info("XLink is disconnected");
        }
Example #17
0
        public void TestIfRemoteStringIsInJavaValid()
        {
            LocalType lt = new LocalType(typeof(String));

            Assert.AreEqual <String>(lt.RemoteTypeFullName, "java.lang.String");
        }
Example #18
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            LocalType lt = (LocalType)this.CB_Type.SelectedIndex;

            switch (lt)
            {
            case LocalType.Boolean:
            {
                if (!bool.TryParse(this.TB_Value.Text, out _))
                {
                    MessageBox.Show(MainWindow.Translate("Message_Local_NoValue_Desc"), MainWindow.Translate("Message_Local_NoValue_Title"), MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                if (this.EditedMacro.BoolLocals.ContainsKey(this.TB_Name.Text) && !this.TB_Name.IsReadOnly)
                {
                    MessageBox.Show(MainWindow.Translate("Message_Local_SameName_Desc"), MainWindow.Translate("Message_Local_SameName_Title"), MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                break;
            }

            case LocalType.Integer:
            {
                if (!int.TryParse(this.TB_Value.Text, out _))
                {
                    MessageBox.Show(MainWindow.Translate("Message_Local_NoValue_Desc"), MainWindow.Translate("Message_Local_NoValue_Title"), MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                if (this.EditedMacro.NumberLocals.ContainsKey(this.TB_Name.Text) && !this.TB_Name.IsReadOnly)
                {
                    MessageBox.Show(MainWindow.Translate("Message_Local_SameName_Desc"), MainWindow.Translate("Message_Local_SameName_Title"), MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                break;
            }

            case LocalType.Real:
            {
                if (!float.TryParse(this.TB_Value.Text, out _))
                {
                    MessageBox.Show(MainWindow.Translate("Message_Local_NoValue_Desc"), MainWindow.Translate("Message_Local_NoValue_Title"), MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                if (this.EditedMacro.RealLocals.ContainsKey(this.TB_Name.Text) && !this.TB_Name.IsReadOnly)
                {
                    MessageBox.Show(MainWindow.Translate("Message_Local_SameName_Desc"), MainWindow.Translate("Message_Local_SameName_Title"), MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                break;
            }

            case LocalType.String:
            {
                if (this.EditedMacro.StringLocals.ContainsKey(this.TB_Name.Text) && !this.TB_Name.IsReadOnly)
                {
                    MessageBox.Show(MainWindow.Translate("Message_Local_SameName_Desc"), MainWindow.Translate("Message_Local_SameName_Title"), MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                break;
            }
            }

            this.DialogResult = true;
            this.Close();
        }
Example #19
0
        public void TestIfRemoteAliveStatIsInJavaValid()
        {
            LocalType lt = new LocalType(typeof(AliveState));

            Assert.AreEqual <String>(lt.RemoteTypeFullName, "org.openengsb.core.api.AliveState");
        }
Example #20
0
 public override string ToString()
 {
     return($"{LocalType.Guillemet().PadLeft(12)} [id: {Id.PadLeft(2)}] “{Name}” =  “{Text}”");
 }
Example #21
0
        public void TestIfRemoteDictionaryIsInJavaValid()
        {
            LocalType lt = new LocalType(typeof(string2stringMapEntry));

            Assert.AreEqual <String>(lt.RemoteTypeFullName, "java.util.Map");
        }
Example #22
0
        public void TestIfRemoteFloatIsInJavaValid()
        {
            LocalType lt = new LocalType(typeof(float));

            Assert.AreEqual <String>(lt.RemoteTypeFullName, "java.lang.Float");
        }
Example #23
0
        public void TestIfRemoteIntIsInJavaValid()
        {
            LocalType lt = new LocalType(typeof(int));

            Assert.AreEqual <String>(lt.RemoteTypeFullName, "java.lang.Integer");
        }