Пример #1
0
        /// <summary>
        /// Creates any number of profiles, and uses the number in the property Number of Profiles To Create.
        /// </summary>
        public void CreateProfiles()
        {
            if (MessageBoxResult.Yes == MessageBox.Show(
                    "Create " + this.NumberOfProfilesToCreate.ToString() + " new profiles on console " +
                    this.XboxName + "\n\nThis may take several minutes. \n\nCreate profiles now?",
                    "Certification Assistance Tool",
                    MessageBoxButton.YesNo))
            {
                // Create
                for (int i = 0; i < this.NumberOfProfilesToCreate; i++)
                {
                    try
                    {
                        Mouse.OverrideCursor = Cursors.Wait;
                        ConsoleProfile profile = this.profilesManager.CreateConsoleProfile(true);
                        this.AllProfiles.Add(new ConsoleProfileViewItem(profile));
                        this.moduleContext.Log(" Created Profile " + profile.Gamertag);

                        // use the new profile
                        if (this.Profile1 == null)
                        {
                            this.Profile1 = this.AllProfiles[this.AllProfiles.Count - 1];
                            this.NotifyPropertyChanged("Profile1");
                        }
                        else if (this.Profile2 == null)
                        {
                            this.Profile2 = this.AllProfiles[this.AllProfiles.Count - 1];
                            this.NotifyPropertyChanged("Profile2");
                        }
                        else if (this.Profile3 == null)
                        {
                            this.Profile3 = this.AllProfiles[this.AllProfiles.Count - 1];
                            this.NotifyPropertyChanged("Profile3");
                        }
                        else if (this.Profile4 == null)
                        {
                            this.Profile4 = this.AllProfiles[this.AllProfiles.Count - 1];
                            this.NotifyPropertyChanged("Profile4");
                        }
                    }
                    catch (Exception e)
                    {
                        string more = string.Empty;
                        if ((uint)e.HResult == 0x80070070)
                        {
                            more = ".\n\nXbox drive is full.";
                        }

                        MessageBox.Show("There was a problem creating a profile: " + e.Message + more, "Certification Assistance Tool");
                        return;
                    }
                    finally
                    {
                        Mouse.OverrideCursor = null;
                    }
                }

                this.UpdateAllStates();
            }
        }
Пример #2
0
        private void ProfileTile_ItemClick(object sender, TileItemEventArgs e)
        {
            var tag = (TileTag)e.Item.Tag;

            try
            {
                Cursor = Cursors.WaitCursor;
                WindowsTaskbarHelper.SetProgressState(TaskbarButtonProgressMode.Indeterminate);
                mainForm.ShowWaitForm("Signing in...");
                tag.Profile.SignIn(0);
                SignedInProfile = tag.Profile;
                Cursor          = Cursors.Default;
                WindowsTaskbarHelper.SetProgressState(TaskbarButtonProgressMode.NoProgress);
                mainForm.CloseWaitForm();
                Close();
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                WindowsTaskbarHelper.SetProgressState(TaskbarButtonProgressMode.Error);
                mainForm.CloseWaitForm();
                XtraMessageBox.Show(string.Format("{0} failed to sign in.{1}{2}", tag.Profile.Gamertag, Environment.NewLine, ex.Message), "DevTool Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            WindowsTaskbarHelper.SetProgressState(TaskbarButtonProgressMode.NoProgress);
        }
Пример #3
0
        private void ButtonAddNewConsole_Click(object sender, EventArgs e)
        {
            foreach (object control in PanelConsoleProfiles.Controls)
            {
                if (control is ConsoleItem item)
                {
                    item.ShouldHover = false;
                }
            }

            ConsoleProfile consoleProfile = DialogExtensions.ShowNewConnectionWindow(this, new ConsoleProfile(), false);

            if (consoleProfile != null)
            {
                Settings.ConsoleProfiles.Add(consoleProfile);
                LoadConsoles();
            }
            else
            {
                foreach (object control in PanelConsoleProfiles.Controls)
                {
                    if (control is ConsoleItem item)
                    {
                        item.ShouldHover = true;
                    }
                }
            }
        }
        /// <summary>
        /// Gets or creates a profile and makes sure it is set to default
        /// </summary>
        /// <param name="manager">manager for the console</param>
        /// <param name="profileNumber">index of the profile to retrieve. a new profile is created if this index is too big. a max of one profile will be created</param>
        /// <returns></returns>
        private ConsoleProfile SafeGetDefaultProfile(ConsoleProfilesManager manager, int profileNumber)
        {
            ConsoleProfile profile = null;

            try
            {
                if (manager.EnumerateConsoleProfiles().Count() > profileNumber)
                {
                    profile = manager.EnumerateConsoleProfiles().ElementAt(profileNumber);
                }
                else
                {
                    profile = manager.CreateConsoleProfile(true);
                }

                manager.SetDefaultProfile(profile);
                profile.SignIn(UserIndex.Zero);
            }
            catch (Exception ex)
            {
                MessageBox.Show("There was a problem getting a profile from " + manager.Console.Name + "\n\nException: " + ex.Message, "Certificaton Assistance Tool");
            }

            return(profile);
        }
Пример #5
0
        private void ButtonConnect_Click(object sender, EventArgs e)
        {
            var selectedItem = ListViewConsoleProfiles.Items[ListViewConsoleProfiles.SelectedIndices[0]];

            ConsoleProfile = MainWindow.Settings.ConsoleProfiles[ListViewConsoleProfiles.Items.IndexOf(selectedItem)];
            Close();
        }
Пример #6
0
        /// <summary>
        /// Get alphabetically first existing profile or create a new one if there are none
        /// </summary>
        /// <param name="device">The xbox to get or create a profile on</param>
        /// <param name="wasCreated">Receives a value indicating a profile was created</param>
        /// <returns>Returns the found or created profile</returns>
        private ConsoleProfile GetFirstProfile(IXboxDevice device, out bool wasCreated)
        {
            ConsoleProfile firstProfile = null;
            wasCreated = false;

            try
            {
                ConsoleProfilesManager profilesManager = device.XboxConsole.CreateConsoleProfilesManager();
                IEnumerable<ConsoleProfile> profiles = profilesManager.EnumerateConsoleProfiles();

                if (profiles.Any())
                {
                    profilesManager.SignOutAllUsers();
                    firstProfile = profiles.First();
                }
                else
                {
                    firstProfile = profilesManager.CreateConsoleProfile(true);
                    wasCreated = true;
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(
                    "There was an error getting a profile from console " + this.xboxDevice.Name + "\n\n" + e.Message,
                    "Certification Assistance Tool");
                throw;
            }

            return firstProfile;
        }
Пример #7
0
        private void ButtonEdit_Click(object sender, EventArgs e)
        {
            int            selectedIndex     = Settings.ConsoleProfiles.IndexOf(ConsoleProfile);
            ConsoleProfile oldConsoleProfile = Settings.ConsoleProfiles[selectedIndex];

            ConsoleProfile newConsoleProfile = DialogExtensions.ShowNewConnectionWindow(this, oldConsoleProfile, true);

            oldConsoleProfile = newConsoleProfile;

            LoadConsoles();
        }
Пример #8
0
        public static ConsoleProfile ShowNewConnectionWindow(Form owner, ConsoleProfile consoleProfile, bool isEditing)
        {
            using NewConnectionDialog newConnectionDialog = new() { ConsoleProfile = consoleProfile, IsEditingProfile = isEditing };

            if (newConnectionDialog.ShowDialog(owner) == DialogResult.OK)
            {
                return(newConnectionDialog.ConsoleProfile);
            }

            return(isEditing ? consoleProfile : null);
        }
Пример #9
0
        private void ButtonAddNewConsole_Click(object sender, EventArgs e)
        {
            ConsoleProfile consoleProfile = DialogExtensions.ShowNewConnectionWindow(this, new ConsoleProfile(), false);

            if (consoleProfile != null)
            {
                Settings.ConsoleProfiles.Add(consoleProfile);
                MainWindow.Window.SaveSettings();
                MainWindow.Window.LoadSettings();
                LoadConsoles();
            }
        }
Пример #10
0
 public static ConsoleProfile ShowNewConnectionWindow(Form owner, ConsoleProfile consoleProfile,
                                                      bool isEditingProfile)
 {
     using (var newConnectionDialog = new NewConnectionDialog
     {
         ConsoleProfile = consoleProfile, IsEditingProfile = isEditingProfile
     })
     {
         return(newConnectionDialog.ShowDialog(owner) == DialogResult.OK
             ? newConnectionDialog.ConsoleProfile
             : null);
     }
 }
Пример #11
0
        /// <summary>
        /// Toggle the Signed In/Out state of the specified profile
        /// </summary>
        /// <param name="profile">ConsoleProfile to sign in or out</param>
        /// <returns>A status string representing the signed in state</returns>
        public string SignInOut(ConsoleProfile profile)
        {
            string state = string.Empty;

            if (profile.GetUserSigninState() != SignInState.NotSignedIn)
            {
                profile.SignOut();
                state = "Sign In";
            }
            else
            {
                profile.SignIn(UserIndex.Zero);
                state = "Sign Out";
            }

            return(state);
        }
        /// <summary>
        /// AreFriended - checks if two profiles are friends
        /// </summary>
        /// <param name="profileA">a profile</param>
        /// <param name="profileB">another profile</param>
        /// <returns>true if profiles are friends, false otherwise</returns>
        private bool AreFriended(ConsoleProfile profileA, ConsoleProfile profileB)
        {
            bool friended = false;

            try
            {
                foreach (Friend friend in profileA.Friends.EnumerateFriends())
                {
                    if (friend.Gamertag == profileB.Gamertag)
                    {
                        friended = true;
                        break;
                    }
                }
            }
            catch
            {
                friended = false;
            }

            return(friended);
        }
Пример #13
0
        private void ButtonEditConsole_Click(object sender, EventArgs e)
        {
            try
            {
                if (MainWindow.IsConsoleConnected && MainWindow.ConsoleProfile == ConsoleProfile)
                {
                    XtraMessageBox.Show(this, "You can't edit the details because you're connected to the console.", "Console Connected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                if (ConsoleProfile != null)
                {
                    foreach (object control in PanelConsoleProfiles.Controls)
                    {
                        if (control is ConsoleItem item)
                        {
                            item.ShouldHover = false;
                        }
                    }

                    int            selectedIndex     = Settings.ConsoleProfiles.IndexOf(ConsoleProfile);
                    ConsoleProfile oldConsoleProfile = Settings.ConsoleProfiles[selectedIndex];

                    ConsoleProfile newConsoleProfile = DialogExtensions.ShowNewConnectionWindow(this, oldConsoleProfile, true);

                    Settings.ConsoleProfiles[selectedIndex] = newConsoleProfile;

                    SelectedItem = null;
                    LoadConsoles();
                }
            }
            catch (Exception ex)
            {
                Program.Log.Error(ex, "Error editing console.");
                XtraMessageBox.Show(this, "Error editing console.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        public bool Setup1()
        {
            bool aborted        = false;
            bool friendingError = false;

            Mouse.OverrideCursor = Cursors.Wait;

            // assign xboxes
            foreach (IXboxDevice dev in this.moduleContext.SelectedDevices)
            {
                if (dev.IsDefault)
                {
                    xboxDevice1 = dev;
                }
            }

            foreach (IXboxDevice dev in this.moduleContext.SelectedDevices)
            {
                if (xboxDevice1 == null)
                {
                    xboxDevice1 = dev;
                    NotifyPropertyChanged("Console1Name");
                }
                else if (xboxDevice2 == null && xboxDevice1 != dev)
                {
                    xboxDevice2 = dev;
                    NotifyPropertyChanged("Console2Name");
                }
                else if (xboxDevice3 == null && xboxDevice1 != dev)
                {
                    xboxDevice3 = dev;
                    NotifyPropertyChanged("Console3Name");
                }
            }

            // get a profile manager for each console
            ReadyMessage  = "Getting three profiles...";
            SetupProgress = 5;
            UpdateSetup();

            try
            {
                this.profileManager1 = xboxDevice1.XboxConsole.CreateConsoleProfilesManager();
                this.profileManager2 = xboxDevice2.XboxConsole.CreateConsoleProfilesManager();
                this.profileManager3 = xboxDevice3.XboxConsole.CreateConsoleProfilesManager();
            }
            catch
            {
            }

            // sign out all profiles
            profileManager1.SignOutAllUsers();
            profileManager2.SignOutAllUsers();
            profileManager3.SignOutAllUsers();

            // select or create and sign in a default profile on each console
            profileA = SafeGetDefaultProfile(profileManager1, 0);
            profileB = SafeGetDefaultProfile(profileManager2, 0);
            profileC = SafeGetDefaultProfile(profileManager3, 0);

            // make sure profiles are not the same one
            if (profileB.Gamertag == profileA.Gamertag)
            {
                profileB = SafeGetDefaultProfile(profileManager2, 1);
            }

            if (profileC.Gamertag == profileB.Gamertag || profileC.Gamertag == profileA.Gamertag)
            {
                profileC = SafeGetDefaultProfile(profileManager3, 1);
            }

            if (profileC.Gamertag == profileB.Gamertag || profileC.Gamertag == profileA.Gamertag)
            {
                profileC = SafeGetDefaultProfile(profileManager3, 2);
            }

            // set Play Through Speakers on all three consoles
            ReadyMessage   = "Setting voice output to speakers only...";
            SetupProgress += 15;
            UpdateSetup();

            Thread th1 = new Thread(new ParameterizedThreadStart(delegate
            {
                xboxDevice1.RunCatScript("Voice_Output_Set_Speakers");
                SetupProgress += 10;
            }));

            th1.Start();
            Thread th2 = new Thread(new ParameterizedThreadStart(delegate
            {
                xboxDevice2.RunCatScript("Voice_Output_Set_Speakers");
                SetupProgress += 10;
            }));

            th2.Start();
            Thread th3 = new Thread(new ParameterizedThreadStart(delegate
            {
                xboxDevice3.RunCatScript("Voice_Output_Set_Speakers");
                SetupProgress += 10;
            }));

            th3.Start();

            th1.Join();
            th2.Join();
            th3.Join();

            ReadyMessage = "Friending profiles...";
            UpdateSetup();

            try
            {
                // Friend profiles A and B
                if (!AreFriended(profileA, profileB))
                {
                    profileB.Friends.SendFriendRequest(profileA);
                    profileA.Friends.AcceptFriendRequest(profileB);
                }
                ProfileAFriended = "Friended";
                ProfileBFriended = "Friended";
                SetupProgress   += 10;
            }
            catch (Exception ex)
            {
                friendingError = true;
                moduleContext.Log("There was an exception friending profile " + ProfileAName + " with " + ProfileBName + ". Exception: " + ex.Message);
            }

            // enable communications for profiles B and c
            ReadyMessage = "Setting Communication Options...";
            UpdateSetup();
            th2 = new Thread(new ParameterizedThreadStart(delegate
            {
                xboxDevice2.RunCatScript("Communications_Set_Everyone");
                ProfileBCommunications = "Everyone";
                SetupProgress         += 10;
            }));
            th2.Start();
            th3 = new Thread(new ParameterizedThreadStart(delegate
            {
                xboxDevice3.RunCatScript("Communications_Set_Everyone");
                ProfileCCommunications = "Everyone";
                SetupProgress         += 10;
            }));
            th3.Start();

            // if friending failed, unblock profile A and friend again. then block profile A
            if (friendingError)
            {
                th1 = new Thread(new ParameterizedThreadStart(delegate
                {
                    xboxDevice1.RunCatScript("Communications_Set_Everyone");
                }));
                th1.Start();
                th2.Join();
                th1.Join();
                try
                {
                    // Friend profiles A and B
                    if (!AreFriended(profileA, profileB))
                    {
                        profileB.Friends.SendFriendRequest(profileB);
                        profileA.Friends.AcceptFriendRequest(profileA);
                    }
                    ProfileAFriended = "Friended";
                    ProfileBFriended = "Friended";
                    SetupProgress   += 10;
                }
                catch (Exception ex)
                {
                    moduleContext.Log("There was an exception friending profile " + ProfileAName + " with " + ProfileBName + ". Exception: " + ex.Message);
                    MessageBox.Show("Unable to friend profiles " + ProfileAName + " and " + ProfileBName + ". Aborting test", "Certificaton Assistance Tool");
                    ProfileAFriended = "Error Friending";
                    ProfileBFriended = "Error Friending";
                    ReadyMessage     = "Aborted";
                    aborted          = true;
                }
            }

            UpdateSetup();
            if (aborted)
            {
                return(false);
            }

            // block profile A
            th1 = new Thread(new ParameterizedThreadStart(delegate
            {
                xboxDevice1.RunCatScript("Communications_Set_Blocked");
                ProfileACommunications = "Blocked";
                SetupProgress         += 10;
            }));
            th1.Start();
            th2.Join();
            th3.Join();
            th1.Join();

            // Install and Launch the game on all three consoles
            ReadyMessage = "Installing and launching " + this.moduleContext.XboxTitle.Name + "...";
            UpdateSetup();
            if (xboxDevice1.IsTitleInstalled)
            {
                ProfileALaunched = "Launching...";
            }
            else
            {
                ProfileALaunched = "Installing...";
            }
            if (xboxDevice2.IsTitleInstalled)
            {
                ProfileBLaunched = "Launching...";
            }
            else
            {
                ProfileBLaunched = "Installing...";
            }
            if (xboxDevice3.IsTitleInstalled)
            {
                ProfileCLaunched = "Launching...";
            }
            else
            {
                ProfileCLaunched = "Installing...";
            }
            UpdateSetup();

            th1 = new Thread(new ParameterizedThreadStart(delegate
            {
                if (!xboxDevice1.IsTitleInstalled)
                {
                    xboxDevice1.InstallTitle(xboxDevice1.PreferredInstallDrive());
                }

                ProfileALaunched = "Launching...";
                xboxDevice1.LaunchTitle();
                ProfileALaunched = "Launched";
                SetupProgress   += 10;
            }));
            th1.Start();
            th2 = new Thread(new ParameterizedThreadStart(delegate
            {
                if (!xboxDevice2.IsTitleInstalled)
                {
                    xboxDevice2.InstallTitle(xboxDevice2.PreferredInstallDrive());
                }

                ProfileBLaunched = "Launching...";
                xboxDevice2.LaunchTitle();
                ProfileBLaunched = "Launched";
                SetupProgress   += 10;
            }));
            th2.Start();
            th3 = new Thread(new ParameterizedThreadStart(delegate
            {
                if (!xboxDevice3.IsTitleInstalled)
                {
                    xboxDevice3.InstallTitle(xboxDevice3.PreferredInstallDrive());
                }

                ProfileCLaunched = "Launching...";
                xboxDevice3.LaunchTitle();
                ProfileCLaunched = "Launched";
                SetupProgress   += 10;
            }));
            th3.Start();
            th1.Join();
            th2.Join();
            th3.Join();
            ReadyMessage = "Ready";
            Setup1Done   = true;
            LogSetup();
            UpdateSetup();
            Mouse.OverrideCursor = null;
            return(true);
        }
Пример #15
0
        /// <summary>
        /// Perform setup
        /// </summary>
        private void Setup()
        {
            Mouse.OverrideCursor = Cursors.Wait;

            // get a profile from each console
            this.ReadyMessage = "Getting profiles...";
            this.UpdateSetup();

            try
            {
                this.profileManager1 = this.xboxDevice1.XboxConsole.CreateConsoleProfilesManager();
                this.profileManager2 = this.xboxDevice2.XboxConsole.CreateConsoleProfilesManager();
            }
            catch
            {
            }

            // sign out all profiles
            this.profileManager1.SignOutAllUsers();
            this.profileManager2.SignOutAllUsers();

            // select or create and sign in a profile on each console
            this.profileA = this.GetAProfile(this.profileManager1, 0);
            this.profileB = this.GetAProfile(this.profileManager2, 0);
            this.profileC = this.GetAProfile(this.profileManager2, 1);

            // make sure profiles are not the same one
            if (this.profileB.Gamertag == this.profileA.Gamertag)
            {
                this.profileB = this.GetAProfile(this.profileManager2, 2);
            }
            else if (this.profileC.Gamertag == this.profileA.Gamertag)
            {
                this.profileC = this.GetAProfile(this.profileManager2, 2);
            }

            // sign in profiles A and B. And C, just long enough to accept friend request
            this.profileA.SignIn(UserIndex.Zero);
            this.profileB.SignIn(UserIndex.Zero);
            this.profileC.SignIn(UserIndex.One);

            this.ReadyMessage = "Friending profiles...";
            this.UpdateSetup();

            try
            {
                // Friend profiles A and B
                if (!this.AreFriended(this.profileA, this.profileB))
                {
                    this.profileA.Friends.SendFriendRequest(this.profileB);
                    this.profileB.Friends.AcceptFriendRequest(this.profileA);
                }

                // Friend profiles A and C
                if (!this.AreFriended(this.profileA, this.profileC))
                {
                    this.profileA.Friends.SendFriendRequest(this.profileC);
                    this.profileC.Friends.AcceptFriendRequest(this.profileA);
                }
            }
            catch (Exception ex)
            {
                this.moduleContext.Log("There was an exception friending profiles. Exception: " + ex.Message);
            }

            // verify friending worked
            try
            {
                // Friend profiles A and B
                if (!this.AreFriended(this.profileA, this.profileB))
                {
                    this.profileA.Friends.SendFriendRequest(this.profileB);
                    this.profileB.Friends.AcceptFriendRequest(this.profileA);
                }

                // Friend profiles A and C
                if (!this.AreFriended(this.profileA, this.profileC))
                {
                    this.profileA.Friends.SendFriendRequest(this.profileC);
                    this.profileC.Friends.AcceptFriendRequest(this.profileA);
                }

                // sign out profile C
                this.profileC.SignOut();
            }
            catch (Exception ex)
            {
                this.moduleContext.Log("There was an exception friending profiles. Exception: " + ex.Message);
            }

            // Install and Launch the game on both consoles (unless game is emulated)
            this.ReadyMessage = "Installing and launching " + this.moduleContext.XboxTitle.Name + "...";
            this.UpdateSetup();
            if (this.IsTitleInstalledOnRightDrive(this.xboxDevice1))
            {
                this.ProfileAInstalled = this.moduleContext.XboxTitle.Name + " Installed";
                this.ProfileALaunched  = this.moduleContext.XboxTitle.Name + " Launching...";
            }
            else
            {
                this.ProfileAInstalled = this.moduleContext.XboxTitle.Name + " Installing...";
            }

            if (this.IsTitleInstalledOnRightDrive(this.xboxDevice2))
            {
                this.ProfileBInstalled = this.moduleContext.XboxTitle.Name + " Installed";
                this.ProfileCInstalled = this.moduleContext.XboxTitle.Name + " Installed";
                this.ProfileBLaunched  = this.moduleContext.XboxTitle.Name + " Launching...";
            }
            else
            {
                this.ProfileBInstalled = this.moduleContext.XboxTitle.Name + " Installing...";
            }

            this.UpdateSetup();

            IXboxDevice deviceWithProgressBar;
            IXboxDevice deviceWithoutProgressBar;

            if (this.IsTitleInstalledOnRightDrive(this.xboxDevice1) && !this.IsTitleInstalledOnRightDrive(this.xboxDevice2))
            {
                deviceWithProgressBar    = this.xboxDevice2;
                deviceWithoutProgressBar = this.xboxDevice1;
            }
            else
            {
                deviceWithProgressBar    = this.xboxDevice1;
                deviceWithoutProgressBar = this.xboxDevice2;
            }

            Thread th1 = new Thread(new ParameterizedThreadStart(delegate
            {
                if (!this.IsTitleInstalledOnRightDrive(deviceWithoutProgressBar))
                {
                    deviceWithoutProgressBar.LaunchDevDashboard();
                    if (deviceWithoutProgressBar == this.xboxDevice1)
                    {
                        deviceWithoutProgressBar.InstallTitle(this.installDrive1);
                    }
                    else
                    {
                        deviceWithoutProgressBar.InstallTitle(this.installDrive2);
                    }
                }

                if (deviceWithoutProgressBar == this.xboxDevice1)
                {
                    this.ProfileAInstalled = this.moduleContext.XboxTitle.Name + " Installed";
                    this.ProfileALaunched  = this.moduleContext.XboxTitle.Name + " Launching...";
                    deviceWithoutProgressBar.LaunchTitle(this.installDrive1);
                    this.ProfileALaunched = this.moduleContext.XboxTitle.Name + " Launched";
                }
                else
                {
                    this.ProfileBInstalled = this.moduleContext.XboxTitle.Name + " Installed";
                    this.ProfileBLaunched  = this.moduleContext.XboxTitle.Name + " Launching...";
                    deviceWithoutProgressBar.LaunchTitle(this.installDrive2);
                    this.ProfileBLaunched = this.moduleContext.XboxTitle.Name + " Launched";
                }
            }));

            th1.Start();
            if (!this.IsTitleInstalledOnRightDrive(deviceWithProgressBar))
            {
                deviceWithProgressBar.LaunchDevDashboard();
                if (deviceWithProgressBar == this.xboxDevice1)
                {
                    deviceWithProgressBar.InstallTitle(this.installDrive1, this.moduleContext.OpenProgressBarWindow("Installing " + this.moduleContext.XboxTitle.Name + "..."));
                    this.ProfileAInstalled = this.moduleContext.XboxTitle.Name + " Installed";
                }
                else
                {
                    deviceWithProgressBar.InstallTitle(this.installDrive2, this.moduleContext.OpenProgressBarWindow("Installing " + this.moduleContext.XboxTitle.Name + "..."));
                    this.ProfileBInstalled = this.moduleContext.XboxTitle.Name + " Installed";
                }
            }

            if (this.moduleContext.XboxTitle.GameInstallType == "Disc Emulation")
            {
                this.ProfileBLaunched = "This is a disc emulation title. Please walk over to console " + this.xboxDevice2.Name + " and start game emulation";
            }
            else
            {
                if (deviceWithProgressBar == this.xboxDevice2)
                {
                    deviceWithProgressBar.LaunchTitle(this.installDrive2);
                    this.ProfileBLaunched = this.moduleContext.XboxTitle.Name + " Launched";
                }
                else
                {
                    deviceWithProgressBar.LaunchTitle(this.installDrive1);
                    this.ProfileALaunched = this.moduleContext.XboxTitle.Name + " Launched";
                }
            }

            th1.Join();

            this.ReadyMessage = "Ready";
            this.UpdateSetup();
            this.moduleContext.Log("Setup test on " + this.xboxDevice1.Name + " with profile " + this.ProfileAName);
            this.moduleContext.Log("          and " + this.xboxDevice2.Name + " with profiles " + this.ProfileBName + " and " + this.ProfileCName);

            Mouse.OverrideCursor = null;
        }
Пример #16
0
        /// <summary>
        /// install title to the consoles
        /// </summary>
        private void Setup()
        {
            System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;

            ConsoleProfilesManager       profilesManager = this.xboxDevice.XboxConsole.CreateConsoleProfilesManager();
            IEnumerable <ConsoleProfile> profiles        = profilesManager.EnumerateConsoleProfiles();

            if (profiles.Count() == 0)
            {
                ConsoleProfile profile = profilesManager.CreateConsoleProfile(true);
                profile.SignIn(UserIndex.Zero);
            }
            else
            {
                profilesManager.SignOutAllUsers();
                ConsoleProfile firstProfile = profiles.First();
                firstProfile.SignIn(UserIndex.Zero);
            }

            System.Windows.Input.Mouse.OverrideCursor = null;

            if (this.xboxDevice.IsTitleInstalled)
            {
                MessageBoxResult messageBoxResult = MessageBox.Show("Launch " + this.moduleContext.XboxTitle.Name + "?", "Certification Assistance Tool", MessageBoxButton.YesNo);
                if (messageBoxResult == MessageBoxResult.Yes)
                {
                    this.xboxDevice.LaunchTitle();
                }
            }
            else
            {
                if (this.xboxDevice.CanInstallTitle)
                {
                    MessageBoxResult messageBoxResult = MessageBox.Show("Install and launch " + this.moduleContext.XboxTitle.Name + "?", "Certification Assistance Tool", MessageBoxButton.YesNo);
                    if (messageBoxResult == MessageBoxResult.Yes)
                    {
                        this.xboxDevice.InstallTitle(this.GetBestAvailableDrive(this.xboxDevice), this.moduleContext.OpenProgressBarWindow("Installing " + this.moduleContext.XboxTitle.Name + "..."));
                        this.xboxDevice.LaunchTitle();
                    }
                }
            }

            this.xboxDevice.XboxConsole.XboxAutomation.BindController(0, 10);
            this.xboxDevice.XboxConsole.XboxAutomation.BindController(1, 10);
            this.xboxDevice.XboxConsole.XboxAutomation.BindController(2, 10);
            this.xboxDevice.XboxConsole.XboxAutomation.BindController(3, 10);
            this.controllersBound = true;

            this.xboxDevice.XboxConsole.XboxAutomation.ClearGamepadQueue(0);
            this.xboxDevice.XboxConsole.XboxAutomation.ClearGamepadQueue(1);
            this.xboxDevice.XboxConsole.XboxAutomation.ClearGamepadQueue(2);
            this.xboxDevice.XboxConsole.XboxAutomation.ClearGamepadQueue(3);

            this.xboxDevice.XboxConsole.XboxAutomation.ConnectController(0);
            this.xboxDevice.XboxConsole.XboxAutomation.ConnectController(1);
            this.xboxDevice.XboxConsole.XboxAutomation.ConnectController(2);
            this.xboxDevice.XboxConsole.XboxAutomation.ConnectController(3);

            this.Quadrant1Connected  = true;
            this.Quadrant2Connected  = true;
            this.Quadrant3Connected  = true;
            this.Quadrant4Connected  = true;
            this.Quadrant1Controlled = true;

            this.VirtualControllerVisibility = Visibility.Visible;
        }
Пример #17
0
        /// <summary>
        /// Queries profiles for the Xbox, which must be selected, and log profiles found
        /// </summary>
        private void InitProfilePage()
        {
            // Start a log file
            this.logStarted = true;
            this.moduleContext.Log("\tMODULE 15 SIGN-IN SIGN OUT");

            // Find the Xbox name
            foreach (IXboxDevice device in this.moduleContext.SelectedDevices)
            {
                if (device.IsSelected)
                {
                    this.moduleContext.Log(" Xbox " + device.Name + " " + device.IP);
                    this.XboxName   = device.IP;
                    this.xboxDevice = device as IXboxDevice;
                    break;
                }
            }

            // Find all profiles on the Xbox
            this.QueryProfileList();

            // Assign profiles on the Xbox to slots
            try
            {
                foreach (ConsoleProfileViewItem item in this.AllProfiles)
                {
                    // Give signed-in profiles the correct quadrant first
                    if (item.Profile.GetUserSigninState() != SignInState.NotSignedIn)
                    {
                        switch (item.Profile.GetUserIndex())
                        {
                        case UserIndex.Zero:
                            this.Profile1        = item;
                            this.Profile1Enabled = true;
                            this.Profile1State   = this.Profile1.Profile.GetUserSigninState().ToString();
                            this.NotifyPropertyChanged("Profile1");
                            break;

                        case UserIndex.One:
                            this.Profile2        = item;
                            this.Profile2Enabled = true;
                            this.Profile2State   = this.Profile2.Profile.GetUserSigninState().ToString();
                            this.NotifyPropertyChanged("Profile2");
                            break;

                        case UserIndex.Two:
                            this.Profile3        = item;
                            this.Profile3Enabled = true;
                            this.Profile3State   = this.Profile3.Profile.GetUserSigninState().ToString();
                            this.NotifyPropertyChanged("Profile3");
                            break;

                        case UserIndex.Three:
                            this.Profile4        = item;
                            this.Profile4Enabled = true;
                            this.Profile4State   = this.Profile4.Profile.GetUserSigninState().ToString();
                            this.NotifyPropertyChanged("Profile4");
                            break;
                        }
                    }
                }

                foreach (ConsoleProfileViewItem item in this.AllProfiles)
                {
                    // assign other profiles to the remaining slots
                    if (item.Profile.GetUserSigninState() == SignInState.NotSignedIn)
                    {
                        if (this.Profile1 == null)
                        {
                            this.Profile1        = item;
                            this.Profile1Enabled = true;
                            this.Profile1State   = this.Profile1.Profile.GetUserSigninState().ToString();
                            this.NotifyPropertyChanged("Profile1");
                        }
                        else if (this.Profile2 == null)
                        {
                            this.Profile2        = item;
                            this.Profile2Enabled = true;
                            this.Profile2State   = this.Profile2.Profile.GetUserSigninState().ToString();
                            this.NotifyPropertyChanged("Profile2");
                        }
                        else if (this.Profile3 == null)
                        {
                            this.Profile3        = item;
                            this.Profile3Enabled = true;
                            this.Profile3State   = this.Profile3.Profile.GetUserSigninState().ToString();
                            this.NotifyPropertyChanged("Profile3");
                        }
                        else if (this.Profile4 == null)
                        {
                            this.Profile4        = item;
                            this.Profile4Enabled = true;
                            this.Profile4State   = this.Profile4.Profile.GetUserSigninState().ToString();
                            this.NotifyPropertyChanged("Profile4");
                        }
                    }
                }
            }
            catch
            {
            } // Xbox went away during setup. don't try to select any more profiles automatically

            this.UpdateAllStates();

            // default the number of profiles to create so that we will end up with at least 4 profiles
            // NumberOfProfilesToCreate = (AllProfiles.Count > 3) ? 0 : 4 - AllProfiles.Count;
            // default to create just one profile at a time, per tester feedback
            this.NumberOfProfilesToCreate = 1;

            // set default seconds between auto profile sign-in
            this.SecondsAuto = 10;

            this.random = new Random();

            this.LogMessage = this.AllProfiles.Count.ToString() + " profiles initially detected:" + Environment.NewLine;
            foreach (ConsoleProfileViewItem cpvi in this.AllProfiles)
            {
                ConsoleProfile cp = cpvi.Profile;
                this.LogMessage += "\t" + cp.Gamertag + " \t\tLIVE=" + cp.IsLiveProfile.ToString() +
                                   " " + cp.Country.ToString() + " " + cp.Tier.ToString() + Environment.NewLine;
            }

            this.moduleContext.Log(this.LogMessage);
        }
        public void setup()
        {
            // get a profile manager for each console
            try
            {
                this.profileManager1 = xboxDevice1.XboxConsole.CreateConsoleProfilesManager();
                this.profileManager2 = xboxDevice2.XboxConsole.CreateConsoleProfilesManager();
                this.profileManager3 = xboxDevice3.XboxConsole.CreateConsoleProfilesManager();
            }
            catch
            {
            }

            // sign out all profiles
            profileManager1.SignOutAllUsers();
            profileManager2.SignOutAllUsers();
            profileManager3.SignOutAllUsers();

            // select and sign in a profile on each console
            if (profileManager1.EnumerateConsoleProfiles().Any())
            {
                profileA = profileManager1.GetDefaultProfile();
                if (profileA == null)
                {
                    profileA = profileManager1.EnumerateConsoleProfiles().First();
                    profileManager1.SetDefaultProfile(profileA);
                }
            }
            else
            {
                profileA = profileManager1.CreateConsoleProfile(true);
            }
            profileA.SignIn(UserIndex.Zero);

            if (profileManager2.EnumerateConsoleProfiles().Any())
            {
                profileB = profileManager2.GetDefaultProfile();
                if (profileB == null)
                {
                    profileB = profileManager2.EnumerateConsoleProfiles().First();
                    profileManager2.SetDefaultProfile(profileB);
                }
            }
            else
            {
                profileB = profileManager2.CreateConsoleProfile(true);
            }
            profileB.SignIn(UserIndex.Zero);

            if (profileManager3.EnumerateConsoleProfiles().Any())
            {
                profileC = profileManager3.GetDefaultProfile();
                if (profileC == null)
                {
                    profileC = profileManager3.EnumerateConsoleProfiles().First();
                    profileManager3.SetDefaultProfile(profileC);
                }
            }
            else
            {
                profileC = profileManager3.CreateConsoleProfile(true);
            }
            profileC.SignIn(UserIndex.Zero);

            // set Play Through Speakers on all three consoles
            xboxDevice1.RunCatScript("Voice_Output_Set_Speakers");
            xboxDevice2.RunCatScript("Voice_Output_Set_Speakers");
            xboxDevice3.RunCatScript("Voice_Output_Set_Speakers");

            // Set privacy settings to voice/text/video to Friends Only profile A
            xboxDevice1.RunCatScript("Communications_Set_Friends_Only");

            // Set privace settings to voice/text/video enabled for Everyone on profile B and C
            xboxDevice2.RunCatScript("Communications_Set_Everyone");
            xboxDevice3.RunCatScript("Communications_Set_Everyone");

            // Friend profiles A and B
            profileA.Friends.SendFriendRequest(profileB);
            profileB.Friends.AcceptFriendRequest(profileA);

            // Launch the game on all three consoles
            xboxDevice1.LaunchTitle();
            xboxDevice2.LaunchTitle();
            xboxDevice3.LaunchTitle();
        }
Пример #19
0
 /// <summary>
 /// Initializes a new instance of the ConsoleProfileViewItem class
 /// ConsoleProfileViewItem function
 /// </summary>
 /// <param name="p">ConsoleProfile for which to use as ViewItem</param>
 public ConsoleProfileViewItem(ConsoleProfile p)
 {
     this.Profile = p;
 }
Пример #20
0
        /// <summary>
        /// Set up both consoles
        /// </summary>
        private void SetUpBothConsoles()
        {
            // choose profiles
            this.AccessSetupText = "Looking for a profile on console " + this.xboxDevice.Name + ".......";
            this.InviteSetupText = "Looking for a profile on console " + this.xboxDevice2.Name + ".......";
            Thread threadProfile = new Thread(new ParameterizedThreadStart(delegate
            {
                this.profile1 = this.GetFirstProfile(this.xboxDevice, out this.profile1IsNew);
            }));

            threadProfile.Start();
            this.profile2 = this.GetFirstProfile(this.xboxDevice2, out this.profile2IsNew);
            threadProfile.Join(2 * 60 * 1000);
            this.AccessSetupText += "profile " + this.profile1.Gamertag;
            this.InviteSetupText += "profile " + this.profile2.Gamertag;
            this.AccessSetupText += this.profile1IsNew ? " Created." : " Found.";
            this.InviteSetupText += this.profile2IsNew ? " Created." : " Found.";
            this.UpdateUIImmediately();

            // sign in the profiles
            this.AccessSetupText += "\nSigning in " + this.profile1.Gamertag + ".......";
            this.InviteSetupText += "\nSigning in " + this.profile2.Gamertag + ".......";
            this.profile1.SignIn(UserIndex.Zero);
            this.profile2.SignIn(UserIndex.Zero);
            this.AccessSetupText += "Signed-in.";
            this.InviteSetupText += "Signed-in.";

            // friend the two profiles
            try
            {
                if (this.profile1IsNew || this.profile2IsNew || !this.AreFriended(this.profile1, this.profile2))
                {
                    this.InviteSetupText += "\nFriending profile " + this.profile1.Gamertag + ".......";
                    this.UpdateUIImmediately();
                    this.profile2.Friends.SendFriendRequest(this.profile1);
                    this.profile1.Friends.AcceptFriendRequest(this.profile2);
                    this.InviteSetupText += "Friended.";
                }
                else
                {
                    this.InviteSetupText += "\nProfiles were already Friended";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    "There was a problem friending the profiles: " + ex.Message,
                    "Certification Assistance Tool");
            }

            // disable multiplayer for first profile, enable it for second profile
            this.xboxDevice.LaunchDevDashboard();
            this.xboxDevice2.LaunchDevDashboard();
            this.AccessSetupText += "\n\nDisabling Multiplayer for profile " + this.profile1.Gamertag + ".......";
            this.InviteSetupText += "\n\nEnabling Multiplayer for profile " + this.profile2.Gamertag + ".......";
            this.UpdateUIImmediately();
            Thread threadMultiplayer = new Thread(new ParameterizedThreadStart(delegate
            {
                try
                {
                    this.xboxDevice2.RunIXBoxAutomationScript(@"Scripts\Enable_Xbox_Live_Game_Play_Privileges.xboxautomation");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("There was a problem enabling multiplayer: " + ex.Message, "Certification Assistance Tool");
                }
            }));

            if (!this.profile2IsNew)
            {
                threadMultiplayer.Start();
            }

            try
            {
                this.xboxDevice.RunIXBoxAutomationScript(@"Scripts\Disable_Xbox_Live_Game_Play_Privileges.xboxautomation");
            }
            catch (Exception ex)
            {
                MessageBox.Show("There was a problem disabling multiplayer: " + ex.Message, "Certification Assistance Tool");
                return;
            }

            if (!this.profile2IsNew)
            {
                threadMultiplayer.Join();
            }

            this.AccessSetupText += "Disabled.";
            this.InviteSetupText += "Enabled.";

            // install title
            Thread threadInstall = new Thread(new ParameterizedThreadStart(delegate
            {
                this.SetUpInvitingConsole();
            }));

            threadInstall.Start();
            this.SetUpControllingConsole();
            threadInstall.Join(2 * 60 * 1000);

            // launch title
            this.AccessSetupText += "\nLaunching " + this.moduleContext.XboxTitle.Name + "...";
            this.InviteSetupText += "\nLaunching " + this.moduleContext.XboxTitle.Name + "...";
            this.UpdateUIImmediately();
            this.xboxDevice.LaunchTitle();
            this.xboxDevice2.LaunchTitle();

            // done
            this.AccessSetupText += "\n\nChild console is ready.";
            this.InviteSetupText += "\n\nRemote Console is ready.";
            this.AccessTestCanAcceptResult = true;
            this.InviteTestCanAcceptResult = true;
            this.UpdateUIImmediately();

            // prompt user to attempt to enter multiplayer
            this.AccessExecutionText = "Use console " + this.xboxDevice.Name + " profile " + this.profile1.Gamertag + " and attempt to enter a multiplayer session in " +
                this.moduleContext.XboxTitle.Name + ".";

            // prompt user to attempt to invite child profile to a multiplayer session
            this.InviteExecutionText += "Invite multiplayer-disabled profile " + this.profile1.Gamertag + " to a multiplayer session.";

            // log setup actions
            this.moduleContext.Log("Console " + this.xboxDevice.Name + " profile " + this.profile1.Gamertag + " has multiplayer disabled.");
            this.moduleContext.Log("Console " + this.xboxDevice2.Name + " profile " + this.profile2.Gamertag + " can invite " + this.xboxDevice.Name + " to a multiplayer session");
            this.moduleContext.Log("Title: " + this.moduleContext.XboxTitle.Name);
        }