Exemplo n.º 1
0
        public ActionEvent Lookup(string eventName)
        {
            ActionEvent myEvent = null;
            string      eventType;

            if (_map.TryGetValue(eventName, out eventType))
            {
                eventType = "Gimp.PhotoshopActions." + eventType;
                Type type = Assembly.GetEntryAssembly().GetType(eventType);

                try
                {
                    myEvent = (ActionEvent)Activator.CreateInstance(type);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Event {0} problem", eventName);
                    Console.WriteLine(e.StackTrace);
                }
            }
            else
            {
                Console.WriteLine("Event {0} unsupported", eventName);

                myEvent = new UnimplementedEvent();

                int amount;
                if (!_statistics.TryGetValue(eventName, out amount))
                {
                    amount = 0;
                }
                _statistics[eventName] = ++amount;
            }
            return(myEvent);
        }
Exemplo n.º 2
0
        public ActionEvent Lookup(string eventName)
        {
            ActionEvent myEvent = null;
              string eventType;

              if (_map.TryGetValue(eventName, out eventType))
            {
              eventType = "Gimp.PhotoshopActions." + eventType;
              Type type = Assembly.GetEntryAssembly().GetType(eventType);

              try
            {
              myEvent = (ActionEvent) Activator.CreateInstance(type);
            }
              catch (Exception e)
            {
              Console.WriteLine("Event {0} problem", eventName);
              Console.WriteLine(e.StackTrace);
            }
            }
              else
            {
              Console.WriteLine("Event {0} unsupported", eventName);

              myEvent = new UnimplementedEvent();

              int amount;
              if (!_statistics.TryGetValue(eventName, out amount))
            {
              amount = 0;
            }
              _statistics[eventName] = ++amount;
            }
              return myEvent;
        }