예제 #1
0
        }                                                 //타겟 아이템

        private void Awake()
        {
            //핸들러 리스트에 현재 핸들러 추가
            if (!HandlerList.Contains(this))
            {
                HandlerList.Add(this);
            }
            if (!HandlerDiction.ContainsValue(this))
            {
                HandlerDiction.Add(this.name, this);
            }

            //아이템 이동 불가시 탭 이동, 스위칭, 머징 끄기
            if (!movable)
            {
                moveToOtherSlot = false;
                switching       = false;
                merging         = false;
            }

            //그래픽 레이캐스트 설정
            if (canvas != null)
            {
                gr = canvas.GetComponent <GraphicRaycaster>();
            }
        }
예제 #2
0
 private void NewConfiguration(CommandRecievedEventArgs e)
 {
     OutputDir     = e.Args[0];
     SourceName    = e.Args[1];
     LogName       = e.Args[2];
     ThumbnailSize = e.Args[3];
     string[] handler = e.Args[4].Split(';');
     if (handler[0] != "")
     {
         foreach (string handle in handler)
         {
             HandlerList.Add(handle);
         }
     }
 }
예제 #3
0
 private void NewConfiguration(CommandRecievedEventArgs e)
 {
     OutputDir  = e.Args[0];
     SourceName = e.Args[1];
     LogName    = e.Args[2];
     ThumbS     = Int32.Parse(e.Args[3]);
     string[] handler = e.Args[4].Split(';');
     if (handler[0] != "")
     {
         foreach (string handle in handler)
         {
             if (!(HandlerList.Contains(handle)))
             {
                 HandlerList.Add(handle);
             }
         }
     }
 }
        private static CustomExpHandlerBase FireHandlerByContainer(HandlerTypeContainer handlerContainer, LG_Layer layer, WardenObjectiveDataBlock objectiveData, bool isGlobalHandler = false)
        {
            if (handlerContainer.Setting == null)
            {
                return(null);
            }

            if (!handlerContainer.Setting.ShouldFire_Internal(layer.m_type, objectiveData))
            {
                return(null);
            }

            var handler = handlerContainer.CreateInstance();

            handler.Setup(layer, objectiveData, isGlobalHandler);
            handler.HandlerGUID = new Guid().ToString();

            _ActiveHandlers.Add(handler);

            return(handler);
        }
        internal static CustomExpHandlerBase[] FireAllGlobalHandler(LG_Layer layer, WardenObjectiveDataBlock objectiveData)
        {
            var handlerList = new HandlerList();

            foreach (var handler in _GlobalHandlers)
            {
                if (!_AllowedGlobalHandlers.Any(x => !string.IsNullOrEmpty(handler.GUID) && x.Equals(handler.GUID, StringComparison.OrdinalIgnoreCase)))
                {
                    continue;
                }

                var handlerInstance = FireHandlerByContainer(handler, layer, objectiveData, isGlobalHandler: true);

                if (handlerInstance != null)
                {
                    handlerList.Add(handlerInstance);
                }
            }

            return(handlerList.ToArray());
        }
예제 #6
0
        /// <summary>
        /// Loads the scanner modules stored in a specified path.
        /// </summary>
        /// <param name='path'>
        /// The path that should be searched for scanners.
        /// </param>
        public virtual void Load(string path)
        {
            var handlersToLoad = new List <Type>();
            var scannersToLoad = new List <Type>();

            try
            {
                Debugger.Status("Searching for loadable modules...");

                // Determine if the directory actually exists before attempting to load the directory.
                if (!Directory.Exists(path))
                {
                    throw new DirectoryNotFoundException();
                }

                //Loop through all of the assembly files in the directory.
                foreach (var file in Directory.GetFiles(path, "*.*", SearchOption.AllDirectories).Where(
                             f => f.EndsWith(".exe", StringComparison.CurrentCultureIgnoreCase) ||
                             f.EndsWith(".dll", StringComparison.CurrentCultureIgnoreCase)))
                {
                    try
                    {
                        /*
                         * Load each assembly into memory and attempt to search it for any `Scanner` types.
                         */
                        var assembly = Assembly.LoadFile(file);
                        foreach (var type in assembly.GetTypes())
                        {
                            if (type.IsSubclassOf(typeof(Scanner)))
                            {
                                //Add this module to the list of scanners to load.
                                scannersToLoad.Add(type);
                            }

                            if (type.IsSubclassOf(typeof(Handler)))
                            {
                                //Add this module to the list of handlers to load.
                                handlersToLoad.Add(type);
                            }
                        }
                    }
                    catch { continue; }
                }

                //Notify user that searching was successful, as well as the number of modules found.
                Debugger.Success();
                Debugger.Put(2, "\tFound {0} loadable modules", Console.ForegroundColor, scannersToLoad.Count);
                Debugger.Put(1, "Loading modules into memory...");

                lock (ScannerList)
                {
                    foreach (var type in scannersToLoad)
                    {
                        /*
                         * LOAD SCANNERS
                         */
                        try
                        {
                            Debugger.Status("\tLoading scanner '" + type.Name + "'");

                            /*
                             * Create a new instance of the class and determine if the class has
                             * been previously loaded (we ignore duplicates--first come, first server).
                             */
                            var module = (Scanner)Activator.CreateInstance(type, new[] { Debugger });
                            if (ScannerList.ContainsKey(module.Id))
                            {
                                throw new Exception("Scanner has already been added!");
                            }

                            /*
                             * Create entries for the module in the scheduler list as well as the
                             * module list.  The next run date is computed based on the module frequency.
                             */
                            ScannerList.Add(module.Id, module);
                            ScheduledList.Add(module.Id, DateTime.Now.AddSeconds(module.Frequency));

                            Debugger.Success();
                            Debugger.Put(3, "\t\tId: {0}\n\t\tVersion: {1}",
                                         ConsoleColor.DarkCyan,
                                         module.Id,
                                         module.Version);
                        }
                        catch (Exception e)
                        {
                            Debugger.Failure(e.InnerException ?? e);
                        }
                    }
                }

                lock (HandlerList)
                {
                    /*
                     * LOAD HANDLERS
                     */
                    try
                    {
                        foreach (var type in handlersToLoad)
                        {
                            Debugger.Status("\tLoading handler '" + type.Name + "'");

                            /*
                             * Create a new instance of the class and determine if the class has
                             * been previously loaded (we ignore duplicates--first come, first server).
                             */
                            var module = (Handler)Activator.CreateInstance(type, new[] { Debugger });
                            if (HandlerList.ContainsKey(module.Id))
                            {
                                throw new Exception("Handler has already been added!");
                            }

                            //Add this handler to the list of handlers.
                            HandlerList.Add(module.Id, module);

                            Debugger.Success();
                            Debugger.Put(3, "\t\tId: {0}\n\t\tVersion: {1}",
                                         ConsoleColor.DarkCyan,
                                         module.Id,
                                         module.Version);
                        }
                    }
                    catch (Exception e)
                    {
                        Debugger.Failure(e.InnerException ?? e);
                    }
                }
            }
            catch (Exception e)
            {
                Debugger.Failure(e);

                //If the module path specified didn't exist we should exit after notifying the user!
                Environment.Exit(-200);
            }
        }