Example #1
0
        public Main()
        {
            FileManager.checkPaths();
            InitializeComponent();
            updateHome();
            net.init(remainingTrial, App.Client.UserData.Type);
            uiversion.Text = "Version " + App.version;

            App.Client.UserData.Settings.PacketSearch    = Properties.Settings.Default.packetSearch;
            App.Client.UserData.Settings.BuyBoost        = Properties.Settings.Default.buyBoost;
            App.Client.UserData.Settings.Reconnect       = Properties.Settings.Default.reconnect;
            App.Client.UserData.Settings.DisableGpu      = Properties.Settings.Default.disableGpu;
            App.Client.UserData.Settings.ManualInjection = Properties.Settings.Default.manualInjection;

            if (App.Client.UserData.Settings.DisableGpu)
            {
                App.gameContainer.Show();
                FileManager.LockCamera();
            }
            if (FileManager.checkRecovery())
            {
                Logger.Push("Recovering smurfs from crash", "warning");
                SmurfManager.recover();
                if (File.Exists("groups.recovery"))
                {
                    File.Delete("groups.recovery");
                }
                if (File.Exists("smurfs.recovery"))
                {
                    File.Delete("smurfs.recovery");
                }
            }
        }
Example #2
0
        private async void messageHandler(JToken msg)
        {
            switch (msg.Value <string>("type"))
            {
            case "status":
                string remoteCount = msg.Value <string>("remoteLength");
                Remotes = "Remote Controllers: " + remoteCount;
                SystemSounds.Exclamation.Play();
                SmurfManager.updateStatus();
                break;

            case "cmdWrite":
                string input = msg.Value <string>("text");
                cmd.writeLine(input);
                break;

            case "updateSettings":
                Logger.Push("Settings Updated", "info");
                dynamic settings = msg.Value <dynamic>("settings");

                App.Client.UserData.Settings.PacketSearch    = (bool)settings.packetSearch;
                Properties.Settings.Default.packetSearch     = App.Client.UserData.Settings.PacketSearch;
                App.Client.UserData.Settings.BuyBoost        = (bool)settings.buyBoost;
                Properties.Settings.Default.buyBoost         = App.Client.UserData.Settings.BuyBoost;
                App.Client.UserData.Settings.Reconnect       = (bool)settings.reconnect;
                Properties.Settings.Default.reconnect        = App.Client.UserData.Settings.Reconnect;
                App.Client.UserData.Settings.DisableGpu      = (bool)settings.disableGpu;
                Properties.Settings.Default.disableGpu       = App.Client.UserData.Settings.DisableGpu;
                App.Client.UserData.Settings.ManualInjection = (bool)settings.manualInjection;
                Properties.Settings.Default.manualInjection  = App.Client.UserData.Settings.ManualInjection;
                Properties.Settings.Default.Save();

                App.gameContainer.Dispatcher.Invoke(new Action(() =>
                {
                    if (App.Client.UserData.Settings.DisableGpu)
                    {
                        App.gameContainer.Show();
                        FileManager.LockCamera();
                    }
                    else
                    {
                        if (App.gameContainer.runningCount() == 0)
                        {
                            App.gameContainer.Hide();
                        }
                    }
                }), DispatcherPriority.ContextIdle);



                SystemSounds.Asterisk.Play();
                if (!underSettingsNotify)
                {
                    underSettingsNotify = true;
                    string _text = Text;
                    Text = _text + ", Settings updated.";
                    await Task.Delay(TimeSpan.FromSeconds(3));

                    if (Text == _text + ", Settings updated.")
                    {
                        Text = _text;
                    }
                    underSettingsNotify = false;
                }
                break;

            case "smurf":
                double remainingTrialSm = Math.Round((double)((App.Client.UserData.Trial - App.Client.Date) / 60000));
                bool   valid            = SmurfManager.smurfs.Count == 0 || App.Client.UserData.Type == (int)2 || (App.Client.UserData.Type == (int)0 && remainingTrialSm > 0);
                if (msg.Value <string>("action") == "start")
                {
                    if (valid)
                    {
                        Smurf newSmurf = msg.Value <dynamic>("smurf").ToObject <Smurf>();
                        SmurfManager.addSmurf(newSmurf);
                        SmurfManager.updateStatus();
                    }
                }
                else
                {
                    Smurf oldSmurf = msg.Value <dynamic>("smurf").ToObject <Smurf>();
                    SmurfManager.stopSmurf(oldSmurf);
                    SmurfManager.updateStatus();
                }
                break;

            case "group":
                double remainingTrialGm = Math.Round((double)((App.Client.UserData.Trial - App.Client.Date) / 60000));
                if (App.Client.UserData.Type == (int)2 || (App.Client.UserData.Type == (int)0 && remainingTrialGm > 0))
                {
                    if (msg.Value <string>("action") == "start")
                    {
                        Group newGroup = msg.Value <dynamic>("group").ToObject <Group>();
                        var   list     = msg.Value <dynamic>("group");

                        SmurfManager.addGroup(newGroup);
                        SmurfManager.updateStatus();
                    }
                    else
                    {
                        Group newGroup = msg.Value <dynamic>("group").ToObject <Group>();
                        SmurfManager.stopGroup(newGroup);
                        SmurfManager.updateStatus();
                    }
                }
                break;
            }
        }