Example #1
0
        public GameProperties(MainForm form)
        {
            InitializeComponent();
            InitializeForm();

            // instances
            gForm       = form;
            gProperties = this;
            SetStartPos();

            gIsReady = PickAGame();
        }
Example #2
0
        public GameProperties(MainForm form, DockerGame game)
        {
            InitializeComponent();
            InitializeForm();

            // instances
            gGame       = new DockerGame(game);
            gForm       = form;
            gProperties = this;
            SetStartPos();

            field_Name.Text      = gGame.Name;
            field_GUID.Text      = gGame.GUID;
            field_Filename.Text  = gGame.Executable;
            field_Version.Text   = gGame.Version;
            field_Developer.Text = gGame.Company;
            field_Arguments.Text = gGame.Arguments;

            GameIcon.BackgroundImage = gGame.Image;

            // Settings tab
            foreach (GameSettings setting in gGame.Settings.Values)
            {
                string FileName = System.IO.Path.GetFileName(setting.Uri);

                if (setting.Type == SettingsType.Registry)
                {
                    FileName = setting.Uri;
                }

                ListViewItem newSetting = new ListViewItem(new string[] { FileName, setting.Uri, Enum.GetName(typeof(SettingsType), setting.Type) }, setting.FileName);
                newSetting.Checked = setting.IsEnabled;
                newSetting.Tag     = setting.IsRelative;
                SettingsList.Items.Add(newSetting);
            }

            // General tab
            checkBoxPowerSpecific.Checked        = gGame.PowerSpecific;
            checkBoxPowerProfileSpecific.Checked = gGame.PowerProfileSpecific;

            // Power Profiles tab
            groupBoxPowerProfile.Enabled = MainForm.MonitorProcesses;

            foreach (PowerProfile profile in MainForm.ProfileDB.Values)
            {
                bool isOnBattery      = profile._ApplyMask.HasFlag(ProfileMask.OnBattery);
                bool isPluggedIn      = profile._ApplyMask.HasFlag(ProfileMask.PluggedIn);
                bool isExtGPU         = profile._ApplyMask.HasFlag(ProfileMask.ExternalGPU);
                bool isOnBoot         = profile._ApplyMask.HasFlag(ProfileMask.OnStartup);
                bool isOnStatusChange = profile._ApplyMask.HasFlag(ProfileMask.OnStatusChange);
                bool isOnScreen       = profile._ApplyMask.HasFlag(ProfileMask.ExternalScreen);
                bool isGameBounds     = profile._ApplyMask.HasFlag(ProfileMask.GameBounds);

                ListViewItem newProfile = new ListViewItem(new string[] { profile.ProfileName, isOnBattery.ToString(), isPluggedIn.ToString(), isExtGPU.ToString(), isOnScreen.ToString() }, profile.ProfileName);
                newProfile.Tag = profile.ProfileGuid;

                // skip default
                if (profile.ApplyPriority == -1)
                {
                    continue;
                }

                if (!isGameBounds)
                {
                    continue;
                }

                if (gGame.PowerProfiles.ContainsKey(profile.ProfileGuid))
                {
                    newProfile.Checked = true;
                }

                ProfilesList.Items.Add(newProfile);
            }

            gIsReady = true;
        }