Exemple #1
0
        public IEnumerable <IMessagePump> CreateAll()
        {
            var openGenericHandlerType = typeof(IHandleRequest <,>);
            var handlerTypes           = _typeProvider.RequestHandlerTypes.ToArray();

            // Create a single connection to each request queue determined by routing
            var allMessageTypesHandledByThisEndpoint = _handlerMapper.GetMessageTypesHandledBy(openGenericHandlerType, handlerTypes);
            var bindings = allMessageTypesHandledByThisEndpoint
                           .Select(m => new { MessageType = m, QueuePath = _router.Route(m, QueueOrTopic.Queue, _pathFactory) })
                           .GroupBy(b => b.QueuePath)
                           .Select(g => new { QueuePath = g.Key, HandlerTypes = g.SelectMany(x => _handlerMapper.GetHandlerTypesFor(openGenericHandlerType, x.MessageType)) });

            // Each binding to a queue can handle one or more request types depending on the routes that are defined
            foreach (var binding in bindings)
            {
                var messageTypes = _handlerMapper.GetMessageTypesHandledBy(openGenericHandlerType, binding.HandlerTypes).ToArray();

                _logger.Debug("Creating message pump for request queue '{0}' handling {1}", binding.QueuePath, messageTypes.ToTypeNameSummary(selector: t => t.Name));

                var messageReceiver   = _transport.GetQueueReceiver(binding.QueuePath);
                var handlerMap        = _handlerMapper.GetHandlerMapFor(openGenericHandlerType, messageTypes);
                var messageDispatcher = _messageDispatcherFactory.Create(openGenericHandlerType, handlerMap);

                var pump = _container.ResolveWithOverrides <MessagePump>(messageReceiver, messageDispatcher);
                GarbageMan.Add(pump);
                yield return(pump);
            }
        }
Exemple #2
0
        public void Dispose()
        {
            GarbageMan.Dispose(this.m_NeedsMasters);
            this.m_NeedsMasters = null;

            this.ValueExtractor = null;
        }
Exemple #3
0
        public void Dispose()
        {
            this.GUIs       = null;
            this.ActiveGUIs = null;

            GarbageMan.Dispose(this.Cursors);
            this.Cursors = null;

            GarbageMan.Dispose(this.CursorColours);
            this.CursorColours = null;

            GarbageMan.Dispose(this.LoadedFonts);
            this.LoadedFonts = null;
            GarbageMan.Dispose(this.FontColours);
            this.FontColours = null;

            GarbageMan.Dispose(this.DyslexicModeFonts);
            this.DyslexicModeFonts = null;

            GarbageMan.Dispose(this.StandardFontSizes);
            this.StandardFontSizes = null;

            GarbageMan.Dispose(this.UISprites);
            this.UISprites = null;

            GarbageMan.Dispose(this.UISpriteColours);
            this.UISpriteColours = null;
        }
Exemple #4
0
        public void Dispose()
        {
            GarbageMan.Dispose(this.m_Materials);
            this.m_Materials = null;

            this.ValueExtractor = null;
        }
Exemple #5
0
        public void Dispose()
        {
            GarbageMan.Dispose(this.LiveItems);
            this.LiveItems = null;

            this.ValueExtractor = null;
        }
Exemple #6
0
        public IMessagePump Create()
        {
            var pump = _container.ResolveWithOverrides <MessagePump>(_transport.GetQueueReceiver(_replyQueueName), _responseMessageDispatcher);

            GarbageMan.Add(pump);
            return(pump);
        }
 public void Dispose()
 {
     GarbageMan.Dispose(this.Skills);
     this.Skills = null;
     GarbageMan.Dispose(this.DefaultSkills);
     this.DefaultSkills  = null;
     this.ValueExtractor = null;
 }
        public void Dispose()
        {
            GarbageMan.Dispose(this.Statistics);
            GarbageMan.Dispose(this.DefaultStatistics);

            this.Statistics        = null;
            this.DefaultStatistics = null;
            this.ValueExtractor    = null;
        }
Exemple #9
0
        public void Dispose()
        {
            var keys = new List <string>(this.WorldTiles.Keys);

            foreach (string key in keys)
            {
                this.WorldTiles.RemoveAll(key);
            }

            this.WorldTiles = null;

            GarbageMan.Dispose(this.WorldInfoDict);
            this.WorldInfoDict = null;
        }
        public IEnumerable <IMessagePump> CreateAll()
        {
            var openGenericHandlerType = typeof(IHandleMulticastRequest <,>);
            var handlerTypes           = _typeProvider.MulticastRequestHandlerTypes.ToArray();

            // Events are routed to Topics and we'll create a competing subscription for the logical endpoint
            var allMessageTypesHandledByThisEndpoint = _handlerMapper.GetMessageTypesHandledBy(openGenericHandlerType, handlerTypes);
            var bindings = allMessageTypesHandledByThisEndpoint
                           .Select(m => new { MessageType = m, TopicPath = _router.Route(m, QueueOrTopic.Topic, _pathFactory) })
                           .GroupBy(b => b.TopicPath)
                           .Select(g => new
            {
                TopicPath    = g.Key,
                MessageTypes = g.Select(x => x.MessageType),
                HandlerTypes = g.SelectMany(x => _handlerMapper.GetHandlerTypesFor(openGenericHandlerType, x.MessageType))
            })
                           .ToArray();

            if (bindings.Any(b => b.MessageTypes.Count() > 1))
            {
                throw new NotSupportedException("Routing multiple message types through a single Topic is not supported.");
            }

            foreach (var binding in bindings)
            {
                foreach (var handlerType in binding.HandlerTypes)
                {
                    var messageType      = binding.MessageTypes.Single();
                    var subscriptionName = _pathFactory.SubscriptionNameFor(_applicationName, handlerType);
                    var filterCondition  = _filterConditionProvider.GetFilterConditionFor(handlerType);

                    _logger.Debug("Creating message pump for multicast request subscription '{0}/{1}' handling {2} with filter {3}",
                                  binding.TopicPath,
                                  subscriptionName,
                                  messageType,
                                  filterCondition);

                    var messageReceiver = _transport.GetTopicReceiver(binding.TopicPath, subscriptionName, filterCondition);
                    var handlerMap      = new Dictionary <Type, Type[]> {
                        { messageType, new[] { handlerType } }
                    };
                    var messageDispatcher = _messageDispatcherFactory.Create(openGenericHandlerType, handlerMap);

                    var pump = _container.ResolveWithOverrides <MessagePump>(messageReceiver, messageDispatcher);
                    GarbageMan.Add(pump);
                    yield return(pump);
                }
            }
        }
        public Modbase(ModContentPack content) : base(content)
        {
            Settings = GetSettings <Settings>();

            ThreadSafeLogger.Message($"[Analyzer] Loaded version {analyzerVersion.Major}.{analyzerVersion.Minor}.{analyzerVersion.Build} rev {analyzerVersion.Revision}");


            { // Profiling
                ModInfoCache.PopulateCache(Content.Name);

                GUIController.InitialiseTabs();

                // GUI needs to be initialised before xml (the tabs need to exist for entries to be inserted into them)
                // XmlParser.CollectXmlData();
            }

            { // Always Running
                StaticHarmony.Patch(AccessTools.Method(typeof(GlobalControlsUtility), nameof(GlobalControlsUtility.DoTimespeedControls)),
                                    prefix: new HarmonyMethod(typeof(GUIElement_TPS), nameof(GUIElement_TPS.Prefix)));

                StaticHarmony.Patch(AccessTools.Method(typeof(Log), nameof(Log.Error)), prefix: new HarmonyMethod(typeof(DebugLogenabler), nameof(DebugLogenabler.ErrorPrefix)), new HarmonyMethod(typeof(DebugLogenabler), nameof(DebugLogenabler.ErrorPostfix)));
                StaticHarmony.Patch(AccessTools.Method(typeof(Prefs), "get_DevMode"), prefix: new HarmonyMethod(typeof(DebugLogenabler), nameof(DebugLogenabler.DevModePrefix)));
                StaticHarmony.Patch(AccessTools.Method(typeof(DebugWindowsOpener), "DevToolStarterOnGUI"), prefix: new HarmonyMethod(typeof(DebugLogenabler), nameof(DebugLogenabler.DebugKeysPatch)));
            }

            { // Performance Patches
                PerformancePatches.InitialisePatches();
            }



#if DEBUG
            ThreadSafeLogger.Warning("==========================================================================");
            ThreadSafeLogger.Warning("                          Analyzer Running In Debug Mode                  ");
            ThreadSafeLogger.Warning("==========================================================================");
#endif

            GarbageMan.Init();
        }
 public void Dispose()
 {
     GarbageMan.Dispose(this.VisionTypes);
     this.VisionTypes = null;
 }
Exemple #13
0
 public void Dispose()
 {
     GarbageMan.Dispose(this.Worlds);
     this.Worlds         = null;
     this.ValueExtractor = null;
 }
Exemple #14
0
 public void Dispose()
 {
     GarbageMan.Dispose(this.m_Entities);
     this.m_Entities = null;
 }
Exemple #15
0
 public void Dispose()
 {
     GarbageMan.Dispose(this.Settings);
     this.Settings       = null;
     this.ValueExtractor = null;
 }