Exemplo n.º 1
0
 public void HandleQuit(QuitEvent quitEvent)
 {
     foreach (var handler in internalHandlers)
     {
         handler.HandleQuit(quitEvent);
     }
 }
Exemplo n.º 2
0
        private static void CurrentDomainOnDomainUnload(object sender,
                                                        EventArgs eventArgs)
        {
            Logger.DebugWithLineNumber("Start CurrentDomainOnDomainUnload.");

            //-------------------------------------------
            // Shut down nodes.
            //-------------------------------------------
            foreach (var appDomainNodeTask in AppDomainNodeTasks)
            {
                appDomainNodeTask.Value.Dispose();
            }

            //-------------------------------------------
            // Shut down managers.
            //-------------------------------------------
            foreach (var appDomainManagerTask in AppDomainManagerTasks)
            {
                appDomainManagerTask.Value.Dispose();
            }

            QuitEvent.Set();

            Logger.DebugWithLineNumber("Finished CurrentDomainOnDomainUnload.");
        }
Exemplo n.º 3
0
 void TriggerQuitEvent(object sender, ButtonEventArgs e)
 {
     if (QuitEvent != null)
     {
         QuitEvent.Invoke(this, EventArgs.Empty);
     }
 }
Exemplo n.º 4
0
        private static void StartSelfHosting()
        {
            var configuration =
                new Configuration(Settings.Default.IntegrationControllerBaseAddress);

            var address =
                configuration.BaseAddress.Scheme + "://+:" + configuration.BaseAddress.Port + "/";

            using (WebApp.Start(address,
                                appBuilder =>
            {
                var builder = new ContainerBuilder();

                var container = builder.Build();

                var config = new HttpConfiguration
                {
                    DependencyResolver = new AutofacWebApiDependencyResolver(container)
                };

                config.MapHttpAttributeRoutes();

                appBuilder.UseAutofacMiddleware(container);
                appBuilder.UseAutofacWebApi(config);
                appBuilder.UseWebApi(config);
            }))
            {
                Logger.InfoWithLineNumber("Started listening on port : ( " + address + " )");

                QuitEvent.WaitOne();
            }
        }
        /// <summary>
        ///     <para>This event is called internally when a use sends QUIT</para>
        /// </summary>
        /// <param name="nick">Nickname of user who quit</param>
        /// <param name="message">Message associated with quit ('reason')</param>
        protected virtual void OnQuit(string nick, string message)
        {
            foreach (Channel c in Channels)
            {
                c.Users.Remove(nick);
            }

            QuitEvent.Raise(this, new QuitEventArgs(nick, message));
        }
Exemplo n.º 6
0
        private static bool ConsoleCtrlCheck(CtrlTypes ctrlType)
        {
            if (ctrlType == CtrlTypes.CtrlCloseEvent ||
                ctrlType == CtrlTypes.CtrlShutdownEvent)
            {
                QuitEvent.Set();

                return(true);
            }

            return(false);
        }
Exemplo n.º 7
0
        protected virtual void OnQuit(string source, string message)
        {
            string sourceNick = source.GetNickFromSource();

            lock (_channels)
            {
                foreach (var c in _channels.Values.Where(x => x.HasUser(sourceNick)))
                {
                    c.RemoveUser(sourceNick);
                }
            }

            QuitEvent.Raise(this, new QuitEventArgs(source, message));
        }
Exemplo n.º 8
0
        private static void StartLoadBalancerProxy(IEnumerable <Uri> managerUriList)
        {
            Logger.DebugWithLineNumber("Start.");

            var configuration = new Configuration(Settings.Default.ManagerLocationUri);

            var address =
                configuration.BaseAddress.Scheme + "://+:9000/StardustDashboard";

            RoundRobin.Set(managerUriList.ToList());

            using (WebApp.Start <LoadBalancerStartup>(address))
            {
                Logger.InfoWithLineNumber("Load balancer started listening on port : ( " + address + " )");

                QuitEvent.WaitOne();
            }
        }
Exemplo n.º 9
0
    void OnQuit(QuitEvent e)
    {
        Dictionary <string, object> UserProperties = new Dictionary <string, object>();

        UserProperties.Add("SDistanceMax", _distanceMax);
        UserProperties.Add("SLastWindow", _lastMenu);
        UserProperties.Add("SCoins", _sumCoin);
        UserProperties.Add("STSession", Time.time - _lastEndSessionTime);
        UserProperties.Add("SRun", _runCount);
        UserProperties.Add("STMenus", Time.time - _lastEndSessionTime - _sumRunTime);
        UserProperties.Add("STRuns", _sumRunTime);
        _amplitude.logEvent("EndSession", UserProperties);

        _distanceMax = 0;
        _sumRunTime  = 0;
        _sumCoin     = 0;
        _runCount    = 0;

        _lastEndSessionTime = Time.time;
    }
Exemplo n.º 10
0
        public static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                PokewatchLogger.Log("[-]Missing Arguments. Indeces of account and regions must be specified.", "PokewatchUnknown");
                Environment.Exit(2);
            }
            s_config = ConfigurationManager.ReadConfiguration("Pokewatch");
            if (s_config == null)
            {
                Environment.Exit(2);
            }
            try
            {
                s_account = s_config.PoGoAccounts[int.Parse(args[0])];
                for (int i = 1; i < args.Length; i++)
                {
                    s_regions.Add(s_config.Regions[int.Parse(args[i])]);
                }
            }
            catch
            {
                PokewatchLogger.Log("[-]Arguments do not align with provided configuration: " + string.Join(" ", args), "PokewatchUnknown");
                Environment.Exit(2);
            }

            try
            {
                s_scanAreas = s_regions.SelectMany(r => r.Locations.Select(l => new ScanArea
                {
                    Location   = l,
                    Name       = r.Name,
                    Prefix     = r.Prefix,
                    Suffix     = r.Suffix,
                    Inclusions = r.Inclusions,
                    Exclusions = r.Exclusions
                })).ToList();
                s_currentScan = s_scanAreas.First();
                s_scanIndex   = 0;
            }
            catch
            {
                PokewatchLogger.Log("[-]Invalid Region Configuration", AccountManager.GetAccountName(s_account));
                Environment.Exit(2);
            }

            Console.Title = AccountManager.GetAccountName(s_account) + ": " + string.Join(", ", s_regions.Select(r => r.Name));

            s_pogoSession = AccountManager.SignIn(s_account, s_currentScan.Location);
            if (s_pogoSession == null)
            {
                PokewatchLogger.Log("[-]Unable to sign in to PokemonGo.", AccountManager.GetAccountName(s_account));
                Environment.Exit(3);
            }

            if (!PrepareTwitterClient())
            {
                Environment.Exit(4);
            }

            PokewatchLogger.Log("[+]Sucessfully signed in to twitter.", AccountManager.GetAccountName(s_account));

            if (s_pogoSession.StartupAsync().Result)
            {
                PokewatchLogger.Log("[-]POGO Couldn't start.", "PokewatchUnknown");
                Environment.Exit(2);
            }

            s_pogoSession.AccessTokenUpdated += (sender, eventArgs) =>
            {
                PokewatchLogger.Log("[+]Access token updated.", AccountManager.GetAccountName(s_account));
            };

            s_pogoSession.Map.Update += (sender, eventArgs) =>
            {
                PokewatchLogger.Log("[+]Location Acknowleged. Searching...", AccountManager.GetAccountName(s_account));
                if (Search())
                {
                    UpdateLocation();
                }
            };

            Console.CancelKeyPress += (sender, eArgs) => {
                QuitEvent.Set();
                eArgs.Cancel = true;
            };

            QuitEvent.WaitOne();
        }
Exemplo n.º 11
0
 public override void HandleQuit(QuitEvent ev)
 {
     Bind(ev.User);
 }
Exemplo n.º 12
0
 public static void OnQuit(QuitEvent evt)
 {
     Sdl.Quit();
     Environment.Exit(0);
 }
Exemplo n.º 13
0
 public virtual void HandleQuit(QuitEvent ev)
 {
 }
Exemplo n.º 14
0
 protected virtual void OnQuit(RemoteServer server)
 {
     QuitEvent?.Invoke(server, EventArgs.Empty);
 }
Exemplo n.º 15
0
 public override void HandleQuit(QuitEvent ev)
 {
     DisplayEvent(ev.User + " has quit (" + ev.Reason + ")", ev.User, new ChatChannel(CHANNEL_QUIT));
 }
Exemplo n.º 16
0
        public static void SendQuitEvent(object sender, QuitEvent evt)
        {
            var handler = OnQuit;

            handler?.Invoke(sender, evt);
        }
Exemplo n.º 17
0
 public static void PublishQuitEvent()
 {
     QuitEvent?.Invoke();
     Instance.EmitSignal(nameof(Quit));
 }
Exemplo n.º 18
0
 internal void OnQuit()
 {
     QuitEvent?.Invoke();
     Dispose();
 }
Exemplo n.º 19
0
 public void OnQuit(EventArgs e)
 {
     QuitEvent?.Invoke(this, e);
 }
Exemplo n.º 20
0
 private void OnApplicationQuit()
 {
     QuitEvent.Invoke();
 }
Exemplo n.º 21
0
 protected virtual void RaiseQuitEvent(TokenEventArgs e)
 {
     QuitEvent?.Invoke(this, e);
 }
 public static void FireQuitEvent()
 {
     QuitEvent?.Invoke(null, null);
 }
Exemplo n.º 23
0
 private IrcEvent ParseQuit(UserData sender, EntityData target, string[] param, string text)
 {
     // Export before deleting data
     var ev = new QuitEvent((User)sender, text);
     Entities.DropUser(sender);
     return ev;
 }