public void ReadConfig(string filename)
        {
            string               fileAsString;
            Regex                typeReg = new Regex(@"<\s*Type\s+(.*)\\\s*Type\s*>", RegexOptions.Singleline);
            MatchCollection      typeMatches;
            MessageTypeTreeModel messageTypeTree;

            using (StreamReader streamReader = new StreamReader(filename))
            {
                // Read from file
                fileAsString = streamReader.ReadToEnd();
                streamReader.Close();
            }

            // Check that we read something
            if ("" != fileAsString)
            {
                // Split into tokens
                if (typeReg.IsMatch(fileAsString))
                {
                    // Read each message type
                    // Create a new Type for each Type found
                    typeMatches = typeReg.Matches(fileAsString);
                    foreach (Match typeMatch in typeMatches)
                    {
                        messageTypeTree = new MessageTypeTreeModel();
                        messageTypeTree.ReadConfig(typeMatch.Groups[1].Value);

                        MessageTypes.Add(messageTypeTree);
                    }
                }
            }
        }
Beispiel #2
0
 private void AddAssemblyTypes(Assembly assembly)
 {
     foreach (var type in assembly.GetTypes())
     {
         MessageTypes.Add(type.FullName);
     }
 }
Beispiel #3
0
        public ViewModel()
        {
            TEST = "jubba";

            m_messageTypes = new List <IMessageType>();

            //add Root items
            MessageTypes.Add(new MessageType {
                Label = "Dummy1", FullPath = @"C:\dummy1"
            });
            MessageTypes.Add(new MessageType {
                Label = "Dummy2", FullPath = @"C:\dummy2"
            });
            MessageTypes.Add(new MessageType {
                Label = "Dummy3", FullPath = @"C:\dummy3"
            });
            MessageTypes.Add(new MessageType {
                Label = "Dummy4", FullPath = @"C:\dummy4"
            });

            //add sub items
            MessageTypes[0].Subtypes = new List <IMessageType>();
            MessageTypes[0].Subtypes.Add(new MessageType {
                Label = "Dummy11", FullPath = @"C:\dummy11"
            });
            MessageTypes[0].Subtypes.Add(new MessageType {
                Label = "Dummy12", FullPath = @"C:\dummy12"
            });
            MessageTypes[0].Subtypes.Add(new MessageType {
                Label = "Dummy13", FullPath = @"C:\dummy13"
            });
            MessageTypes[0].Subtypes.Add(new MessageType {
                Label = "Dummy14", FullPath = @"C:\dummy14"
            });
        }
Beispiel #4
0
        // Methods

        protected override void Awake()
        {
            base.Awake();

            StateController.CurrentStateSync += StateManager_CurrentStateSync;

            MessageTypes.Add(stateControllerMessage.MessageType);
        }
        private void OnAddType(string str = "")
        {
            MessageTypes.Add(new MessageTypeTreeModel
            {
                SubtypeName = (str == "") ? "New Type" : str
            });

            OnPropertyChanged("MessageTypes");
        }
Beispiel #6
0
        // Methods

        protected override void Awake()
        {
            base.Awake();

            deviceControllerMessage = new DeviceControllerSyncMessage(DeviceController, () =>
            {
                SendToServer(deviceControllerMessage, Channels.DefaultReliable);
            });
            MessageTypes.Add(deviceControllerMessage.MessageType);
        }
Beispiel #7
0
        // Implement collection symantics so that we can work as a collection
        // of message types.
        /// <summary>
        /// Add a message type to this decoder
        /// </summary>
        /// <param name="type">Type of a message class</param>
        public void Add(Type type)
        {
            string attribNameValue = MessageBase.LookupMessageName(type);

            Contracts.IsNotNullOrWhitespace(attribNameValue, $"Invalid command Name attribute is set for the command or response structure. {type}");

            if (!MessageTypes.ContainsKey(attribNameValue))
            {
                MessageTypes.Add(attribNameValue, type);
            }
        }
Beispiel #8
0
        // Methods

        protected override void Awake()
        {
            base.Awake();

            MessageTypes.Add(independentVariablesMessage.MessageType);

            IndependentVariables = new List <IIndependentVariable>(independentVariables.Length);
            foreach (var independentVariable in independentVariables)
            {
                IndependentVariables.Add(independentVariable);
                independentVariable.CurrentConditionSync += IndependentVariable_CurrentConditionSync;
            }
            DeviceConnected += DevicesInfoSync_DeviceConnected;
        }
Beispiel #9
0
        public ChatUIViewModel()
        {
            MessageTypes.Add("Chat");
            MessageTypes.Add("Whisper");
            MessageTypes.Add("Language");
            MessageTypes.Add("Command");
            MessageTypes.Add("Other");

            MessageContexts.Add("ChatContext1");
            MessageContexts.Add("ChatContext2");
            MessageContexts.Add("WhisperContext1");
            MessageContexts.Add("WhisperContext2");
            MessageContexts.Add("etc");
        }
        // MonoBehaviour methods

        protected override void Awake()
        {
            base.Awake();

            gridConfigureMessage = new TaskGridSyncConfigureMessage(TaskGrid, () =>
            {
                SendToServer(gridConfigureMessage);
            });
            gridEventsMessage = new TaskGridSyncEventsMessage(TaskGrid, () =>
            {
                SendToServer(gridEventsMessage);
            });
            gridDragMessage = new TaskGridSyncDragMessage(TaskGrid);
            gridZoomMessage = new TaskGridSyncZoomMessage(TaskGrid);

            MessageTypes.Add(gridConfigureMessage.MessageType);
            MessageTypes.Add(gridEventsMessage.MessageType);
            MessageTypes.Add(gridDragMessage.MessageType);
            MessageTypes.Add(gridZoomMessage.MessageType);
        }
        /// <summary>
        /// assume now for one message type we have only one channel
        /// </summary>
        /// <param name="channelName"></param>
        /// <param name="m"></param>
        /// <param name="moduleName">For exception information if occured model conflicts</param>
        public void AssignMessageTypeToChannel(string channelName, TItemModel m, string moduleName)
        {
            int v;

            if (MessageChannels.TryGetValue(channelName, out v))
            {
                MessageChannel channel = MChannelsList[v];
                if (channel.AssignedMessageModel == null)
                {
                    channel.FirstModuleNameAssigned = moduleName;
                    channel.AssignedMessageType     = m.ItemTypeName;
                    channel.AssignedMessageModel    = m;
                    //if (!MessageTypes.ContainsKey(m.ItemTypeName))
                    MessageTypes.Add(m.ItemTypeName, v);
                }
            }
            else
            {
                throw new Exception("Error: assign message type model to channel: channel name " + channelName + "not exists");
            }
        }
Beispiel #12
0
 public BusOptions()
 {
     MessageTypes.Add(typeof(IMessage));
 }
Beispiel #13
0
 public BusOptions()
 {
     Subscriptions.Add(new TypeSubscription(typeof(ISubscriber)));
     MessageTypes.Add(typeof(IMessage));
 }