예제 #1
0
        public bool Delete()
        {
            try
            {
                var link = Link.GetLink(this);

                DataInterface <BugTicket> .Delete(this.ID);

                link.Delete();

                return(true);
            }
            catch (Exception) { return(false); }
        }
예제 #2
0
        private bool Login(string Username, string Password)
        {
            var Result = WebInterface.Login(Username, Password);

            switch (Result.Result)
            {
            case WebInterface.LoginResult.OK:
            {
                DataInterface.Delete("login");
                DataInterface.Save("token", Result.Token);
                return(true);
            }

            case WebInterface.LoginResult.INVALID_USER_PASS:
            {
                Dispatcher.Invoke(() =>
                    {
                        MessageBox.Show(
                            "Invalid username/email or password.",
                            "Synapse X", MessageBoxButton.OK, MessageBoxImage.Error);
                        LoginButton.Content = "Login";
                        LoggingIn           = false;
                    });
                return(false);
            }

            case WebInterface.LoginResult.NOT_MIGRATED:
            {
                Migrate(Username, Password);
                return(false);
            }

            case WebInterface.LoginResult.INVALID_REQUEST:
            case WebInterface.LoginResult.UNKNOWN:
            {
                Dispatcher.Invoke(() =>
                    {
                        Topmost = false;
                        MessageBox.Show(
                            "Failed to login to Synapse account. Please contact 3dsboy08 on Discord.",
                            "Synapse X", MessageBoxButton.OK, MessageBoxImage.Error);
                    });
                Environment.Exit(0);
                return(false);
            }
            }

            return(false);
        }
예제 #3
0
 public bool Delete()
 {
     try { DataInterface <Link> .Delete(this.ID); return(true); }
     catch (Exception) { return(false); }
 }
예제 #4
0
        private void CloseButton_Click(object sender, RoutedEventArgs e)
        {
            Globals.Options = new Data.Options
            {
                AutoAttach  = AutoAttachBox.IsChecked.Value,
                AutoLaunch  = AutoLaunchBox.IsChecked.Value,
                MultiRoblox = false,
                UnlockFPS   = UnlockBox.IsChecked.Value,
                InternalUI  = InternalUIBox.IsChecked.Value,
                IngameChat  = IngameChatBox.IsChecked.Value,
                BetaRelease = BetaReleaseBox.IsChecked.Value,
                WindowScale = ScaleSlider.Value
            };
            DataInterface.Save("options", new Data.OptionsHolder
            {
                Version = Data.OptionsVersion,
                Data    = JsonConvert.SerializeObject(Globals.Options)
            });

            if (BetaStatus != BetaReleaseBox.IsChecked)
            {
                MessageBox.Show(
                    "You have chosen to either enable/disable Synapse X beta releases. You must now restart Synapse X in order to install the beta release.",
                    "Synapse X", MessageBoxButton.OK, MessageBoxImage.Information);
                Environment.Exit(0);
            }

            if (LaunchStatus != AutoLaunchBox.IsChecked)
            {
                try
                {
                    var Key           = Registry.ClassesRoot.OpenSubKey("roblox-player\\shell\\open\\command", true);
                    var BaseDirectory = Path.Combine(Directory.GetParent(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)).FullName);
                    if (Key == null)
                    {
                        throw new Exception("SubKey is invalid.");
                    }

                    if (AutoLaunchBox.IsChecked == true)
                    {
                        var Value = ((string)Key.GetValue("")).Split('"').Where((Item, Idx) => Idx % 2 != 0).ToArray()[0];
                        Key.SetValue("", $"\"{BaseDirectory + "\\" + Globals.LauncherPath}\" %1");
                        DataInterface.Save("launcherbackup", Value);
                    }
                    else
                    {
                        if (!DataInterface.Exists("launcherbackup"))
                        {
                            MessageBox.Show("Failed to get launcher backup. You should reinstall Roblox.", "Synapse X",
                                            MessageBoxButton.OK, MessageBoxImage.Warning);

                            Main.OptionsOpen = false;
                            Close();
                            return;
                        }

                        Key.SetValue("", $"\"{DataInterface.Read<string>("launcherbackup")}\" %1");
                        DataInterface.Delete("launcherbackup");
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show($"Failed to {((bool)AutoLaunchBox.IsChecked ? "setup" : "remove")} AutoLaunch. Please check your anti-virus software.", "Synapse X",
                                    MessageBoxButton.OK, MessageBoxImage.Warning);

                    return;
                }
            }

            if (Main.Ready())
            {
                MessageBox.Show("Some options may not apply until you reinject Synapse.", "Synapse X",
                                MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            Main.OptionsOpen           = false;
            Main.ScaleTransform.ScaleX = ScaleSlider.Value;
            Main.ScaleTransform.ScaleY = ScaleSlider.Value;

            Close();
        }