protected virtual void MassSetMode(HandlerMode mode)
 {
     foreach (var gizmo in AffectedGizmos)
     {
         gizmo.comp.Mode = mode;
     }
 }
Esempio n. 2
0
        public static void Enable(HandlerMode mode)
        {
            _exitOnFailure    = mode == HandlerMode.ExitApplication || mode == HandlerMode.ExitAndRestart;
            _restartOnFailure = mode == HandlerMode.ExitAndRestart;

            //Application.SetUnhandledExceptionMode(_exitOnFailure ? UnhandledExceptionMode.ThrowException : UnhandledExceptionMode.CatchException);
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
        }
Esempio n. 3
0
        public PacketHandler(string host, int port, HandlerMode mode)
        {
            Mode = mode;

            _tcp = new TcpClient(host, port);

            _stream = new NetworkStreamMC(_tcp.GetStream());

            _packetHandler = new Thread(Worker)
                                 {
                                     Name = "SC#PacketHandler",
                                     IsBackground = true
                                 };

            _packetHandler.Start();
        }
Esempio n. 4
0
        public static PacketBase TagFromId(Packet id, HandlerMode mode)
        {
            if (mode == HandlerMode.Client)
            {
                if (!ClientPackets.ContainsKey(id))
                {
                    throw new NotImplementedException(string.Format("Invalid client packet 0x{0:X2}", (byte)id));
                }

                return ClientPackets[id]();
            }

            if (!ServerPackets.ContainsKey(id))
            {
                throw new NotImplementedException(string.Format("Invalid server packet 0x{0:X2}", (byte)id));
            }

            return ServerPackets[id]();
        }
Esempio n. 5
0
 public static string Label(this HandlerMode mode) => $"Fluffy.AnimalTab.HandlerMode.{mode}".Translate();
Esempio n. 6
0
 public HandlerItem(Type type, object handler, HandlerMode mode)
 {
     Type    = type;
     Handler = handler;
     Mode    = mode;
 }
Esempio n. 7
0
 public void Register <T>(IConsumerOf <T> handler, HandlerMode mode) where T : Message
 {
     _handlers.Add(new KeyValuePair <Type, HandlerItem>(typeof(IConsumerOf <T>), new HandlerItem(typeof(T), handler, mode)));
 }