コード例 #1
0
 protected virtual void MassSetMode(HandlerMode mode)
 {
     foreach (var gizmo in AffectedGizmos)
     {
         gizmo.comp.Mode = mode;
     }
 }
コード例 #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;
        }
コード例 #3
0
ファイル: PacketHandler.cs プロジェクト: pollyzoid/mclib
        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();
        }
コード例 #4
0
ファイル: PacketBase.cs プロジェクト: pollyzoid/mclib
        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]();
        }
コード例 #5
0
 public static string Label(this HandlerMode mode) => $"Fluffy.AnimalTab.HandlerMode.{mode}".Translate();
コード例 #6
0
 public HandlerItem(Type type, object handler, HandlerMode mode)
 {
     Type    = type;
     Handler = handler;
     Mode    = mode;
 }
コード例 #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)));
 }