Exemplo n.º 1
0
        public void AddItem()
        {
            HostWindow hostWindow = new HostWindow();

            hostWindow.DataContext = new HostViewModel(new Host());
            hostWindow.Title       = "Add new Host";
            hostWindow.ResizeMode  = ResizeMode.NoResize;
            hostWindow.ShowDialog();
        }
Exemplo n.º 2
0
        public void EditItem(Host model)
        {
            HostWindow hostWindow = new HostWindow();

            hostWindow.DataContext = new HostViewModel(model);
            hostWindow.Title       = "Edit Host: " + model.Name;
            hostWindow.ResizeMode  = ResizeMode.NoResize;
            hostWindow.ShowDialog();
        }
Exemplo n.º 3
0
        private void OnClickConnect(System.Object Sender, System.EventArgs e)
        {
            //prntSome.printSome("OnClickConnect");
            HostWindow hostWindow = new HostWindow();

            //hostWindow.HostName.Text = "192.168.3.85";
            hostWindow.HostName.Text = "5.8.68.217";
            this.runOffline          = true;
            System.Windows.Forms.DialogResult RetVal = hostWindow.ShowDialog(this);

            if (RetVal == System.Windows.Forms.DialogResult.OK)
            {
                hostWindow.Dispose();
                this.runOffline = false;
                this.Connect(hostWindow.HostName.Text);
            }
            else
            {
                hostWindow.Dispose();
                this.runOffline = true;
                //System.Windows.Forms.Application.ExitThread ();
                //System.Windows.Forms.Application.Exit ();
            }
        }
        private void InitLauncher()
        {
            Log.Info("Initializing launcher...");
            SteamHelper.Initialize();

            if (this.Config.SelectedInstall != null && (this.Config.SelectedInstall.Path == null || !Directory.Exists(this.Config.SelectedInstall.Path)))
            {
                this.Config.SelectedInstall = null;
            }

            if (this.Config.SelectedInstall == null)
            {
                GTAInstall[] installs = GTAInstall.FindInstalls();

                if (installs.Length > 0)
                {
                    this.Config.SelectedInstall = installs[0];
                }
                else
                {
                    LocalizedMessage.Show("GTANotFound", "Info", DialogIcon.Information, DialogButtons.Ok);
                    HostWindow host = new HostWindow();
                    host.Content = new ChooseInstallDialog(host);
                    host.ShowDialog();

                    if (this.Config.SelectedInstall == null)
                    {
                        Environment.Exit(1);
                        return;
                    }
                }

                this.Config.Save();
            }

            Log.Info("Using GTA V installation at " + this.Config.SelectedInstall.Path);
            Log.Info("Installation type: " + this.Config.SelectedInstall.Type);

            if (Path.GetFullPath(this.WorkingDirectory).Equals(Path.GetFullPath(this.Config.SelectedInstall.Path)))
            {
                LocalizedMessage.Show("InstalledInGTA", "Error", DialogIcon.Error, DialogButtons.Ok);
                Environment.Exit(1);
            }

            GameScanner.Init();

            Log.Info("Loading profiles...");

            string profilesDir = Path.Combine(this.UserDirectory, "Profiles");

            if (!Directory.Exists(profilesDir))
            {
                Directory.CreateDirectory(profilesDir);
            }

            if (this.Config.VanillaProfile == null)
            {
                Log.Info("Vanilla profile not found. Creating it");
                this.Config.Profiles.Add(new Profile("Vanilla", true));
            }

            foreach (string dir in Directory.EnumerateDirectories(profilesDir))
            {
                string name = Path.GetFileName(dir);
                if (!this.Config.ProfileExists(name))
                {
                    this.Config.Profiles.Add(new Profile(name));
                }
            }

            if (this.Config.Profile == null)
            {
                Log.Info("Current profile is invalid");

                if (GameScanner.IsGTAModded())
                {
                    Log.Info("GTA is currently modded: creating new modded profile");
                    Profile profile = new Profile(this.GetNewProfileName());
                    this.Config.Profiles.Add(profile);
                    this.Config.Profile = profile;
                }
                else
                {
                    Log.Info("GTA is currently not modded: considering the game vanilla");
                    this.Config.CurrentProfile = this.Config.VanillaProfile.Name;
                }
            }
        }
Exemplo n.º 5
0
        private void OnClickConnect(System.Object Sender, System.EventArgs e)
        {
            //prntSome.printSome("OnClickConnect");
            HostWindow hostWindow = new HostWindow ();
            //hostWindow.HostName.Text = "192.168.3.85";
            hostWindow.HostName.Text = "5.8.68.217";
            this.runOffline = true;
            System.Windows.Forms.DialogResult RetVal = hostWindow.ShowDialog (this);

            if (RetVal == System.Windows.Forms.DialogResult.OK)
            {
                hostWindow.Dispose ();
                this.runOffline = false;
                this.Connect (hostWindow.HostName.Text);
            }
            else
            {
                hostWindow.Dispose ();
                this.runOffline = true;
                //System.Windows.Forms.Application.ExitThread ();
                //System.Windows.Forms.Application.Exit ();
            }
        }