예제 #1
0
파일: DTEEvents.cs 프로젝트: DzmitrySo/mc
 public void Unsubcribe(MetaCommand item)
 {
     foreach (var items in _subscribers.Values)
     {
         items.Remove(item);
     }
 }
예제 #2
0
파일: DTEEvents.cs 프로젝트: DzmitrySo/mc
        public void Subscribe(EventType eventType, MetaCommand item)
        {
            HashSet<MetaCommand> items;
            if (!_subscribers.TryGetValue(eventType, out items))
            {
                _subscribers[eventType] = items = new HashSet<MetaCommand>();
            }

            if (!items.Contains(item))
            {
                items.Add(item);
            }
        }
예제 #3
0
파일: MetaCommand.cs 프로젝트: DzmitrySo/mc
            public CommandActionInternal(MetaCommand metaCommand, CodeClass2 mcclass)
            {
                _metaCommand = metaCommand;
                _mcclass = mcclass;

                foreach (CodeAttribute2 attr in mcclass.Attributes)
                {
                    if (attr.FullName == typeof(WhenFileChangedAttribute).FullName)
                    {
                        _eventType = EventType.FileChanged;
                        var attrParameters = attr.Arguments.Cast<CodeAttributeArgument>().Select(_ => _.Value.Trim('\"')).ToArray();
                        _fileChangedMasks.Add(new FileChangedArgument(attrParameters[0], attrParameters[1], true));

                        DTEHelper.Events.Subscribe(_eventType, _metaCommand);
                    }
                }
            }