コード例 #1
0
        private void Refresh(bool throwErrors)
        {
            try
            {
                IEnumerable <IConfigurationData> config = DataSourceAdapter.GetConfiguration();

                IdGamesUrl = GetValue(config, "IdGamesUrl");
                ApiPage    = GetValue(config, "ApiPage");
                MirrorUrl  = GetValue(config, "MirrorUrl");
                CleanTemp  = Convert.ToBoolean(GetValue(config, "CleanTemp"));

                SetChildDirectories(config);
                SplitTopBottom        = Convert.ToInt32(GetValue(config, "SplitTopBottom"));
                SplitLeftRight        = Convert.ToInt32(GetValue(config, "SplitLeftRight"));
                AppWidth              = Convert.ToInt32(GetValue(config, "AppWidth"));
                AppHeight             = Convert.ToInt32(GetValue(config, "AppHeight"));
                AppX                  = Convert.ToInt32(GetValue(config, "AppX"));
                AppY                  = Convert.ToInt32(GetValue(config, "AppY"));
                WindowState           = (FormWindowState)Enum.Parse(typeof(FormWindowState), GetValue(config, "WindowState"));
                ColumnConfig          = GetValue(config, "ColumnConfig");
                ScreenshotPreviewSize = Convert.ToInt32(GetValue(config, "ScreenshotPreviewSize"));

                DateParseFormats             = Util.SplitString(GetValue(config, "DateParseFormats"));
                ScreenshotCaptureDirectories = Util.SplitString(GetValue(config, "ScreenshotCaptureDirectories"));
            }
            catch (Exception)
            {
                if (throwErrors)
                {
                    throw;
                }
            }
            VerifyPaths(throwErrors);
        }
コード例 #2
0
ファイル: Util.cs プロジェクト: nstlaurent/DoomLauncher
        private static List <IGameFile> GetAdditionalFiles(IDataSourceAdapter adapter, string property)
        {
            string[]         fileNames = Util.SplitString(property);
            List <IGameFile> gameFiles = new List <IGameFile>();

            Array.ForEach(fileNames, x => gameFiles.Add(adapter.GetGameFile(x)));
            return(gameFiles.Where(x => x != null).ToList());
        }
コード例 #3
0
        public void SetGameProfile(IGameProfile gameProfile)
        {
            SetIwadInfoLabel();

            UnregisterEvents();
            m_handler = new FileLoadHandler(m_adapter, GameFile, gameProfile);

            SetDefaultSelections();
            GameProfile.ApplyDefaultsToProfile(gameProfile, m_appConfig);
            cmbProfiles.SelectedValue = gameProfile.GameProfileID;

            if (GameFile != null)
            {
                chkSaveStats.Checked      = gameProfile.SettingsStat;
                chkLoadLatestSave.Checked = gameProfile.SettingsLoadLatestSave;

                if (gameProfile.SourcePortID.HasValue)
                {
                    SelectedSourcePort = m_adapter.GetSourcePort(gameProfile.SourcePortID.Value);
                }

                // Selected GameFile is an IWAD so lock the IWAD selection
                if (IsIwad(GameFile))
                {
                    cmbIwad.Enabled = false;
                    SelectedIWad    = GameFile;
                }
                else if (gameProfile.IWadID.HasValue)
                {
                    SelectedIWad = m_adapter.GetGameFileIWads().FirstOrDefault(x => x.IWadID == gameProfile.IWadID);
                }

                if (!string.IsNullOrEmpty(gameProfile.SettingsMap))
                {
                    SelectedMap = gameProfile.SettingsMap;
                }
                if (!string.IsNullOrEmpty(gameProfile.SettingsSkill))
                {
                    SelectedSkill = gameProfile.SettingsSkill;
                }
                if (!string.IsNullOrEmpty(gameProfile.SettingsExtraParams))
                {
                    ExtraParameters = gameProfile.SettingsExtraParams;
                }
                if (!string.IsNullOrEmpty(gameProfile.SettingsSpecificFiles))
                {
                    SpecificFiles = Util.SplitString(gameProfile.SettingsSpecificFiles);
                }
            }

            bool reset = ShouldRecalculateAdditionalFiles();

            HandleSourcePortSelectionChange(reset);
            HandleIwadSelectionChanged(reset);
            SetAdditionalFiles(reset);
            HandleDemoChange();
            RegisterEvents();
        }
コード例 #4
0
        private void ChangeButton_Click(object sender, EventArgs e)
        {
            DirectoriesForm form = new DirectoriesForm();

            form.SetDirectories(Util.SplitString(m_screenshotDirectories.Text));
            form.StartPosition = FormStartPosition.CenterParent;

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                m_screenshotDirectories.Text = string.Join(";", form.GetDirectories());
            }
        }
コード例 #5
0
        private void Refresh(bool throwErrors)
        {
            try
            {
                IEnumerable <IConfigurationData> config = DataSourceAdapter.GetConfiguration();

                IdGamesUrl = GetValue(config, "IdGamesUrl");
                ApiPage    = GetValue(config, "ApiPage");
                MirrorUrl  = GetValue(config, "MirrorUrl");
                CleanTemp  = Convert.ToBoolean(GetValue(config, "CleanTemp"));

                SetChildDirectories(config);
                SplitTopBottom               = Convert.ToInt32(GetValue(config, SplitTopBottomName));
                SplitLeftRight               = Convert.ToInt32(GetValue(config, SplitLeftRightName));
                SplitTagSelect               = Convert.ToInt32(GetValue(config, SplitTagSelectName));
                AppWidth                     = Convert.ToInt32(GetValue(config, AppWidthName));
                AppHeight                    = Convert.ToInt32(GetValue(config, AppHeightName));
                AppX                         = Convert.ToInt32(GetValue(config, AppXName));
                AppY                         = Convert.ToInt32(GetValue(config, AppYName));
                WindowState                  = (FormWindowState)Enum.Parse(typeof(FormWindowState), GetValue(config, WindowStateName));
                ColumnConfig                 = GetValue(config, ColumnConfigName);
                ScreenshotPreviewSize        = Convert.ToInt32(GetValue(config, ScreenshotPreviewSizeName));
                FileManagement               = (FileManagement)Enum.Parse(typeof(FileManagement), GetValue(config, "FileManagement"));
                ItemsPerPage                 = Convert.ToInt32(GetValue(config, ItemsPerPageName));
                DeleteScreenshotsAfterImport = Convert.ToBoolean(GetValue(config, "DeleteScreenshotsAfterImport"));
                LastSelectedTabIndex         = Convert.ToInt32(GetValue(config, LastSelectedTabIndexName));
                TagSelectPinned              = Convert.ToBoolean(GetValue(config, TagSelectPinnedName));
                ShowTabHeaders               = Convert.ToBoolean(GetValue(config, ShowTabHeadersName));
                CopySaveFiles                = Convert.ToBoolean(GetValue(config, CopySaveFilesName));

                var newType = (GameFileViewType)Enum.Parse(typeof(GameFileViewType), GetValue(config, "GameFileViewType"));
                if (newType != GameFileViewType)
                {
                    GameFileViewType = newType;
                    GameFileViewTypeChanged?.Invoke(this, EventArgs.Empty);
                }

                DateParseFormats             = Util.SplitString(GetValue(config, "DateParseFormats"));
                ScreenshotCaptureDirectories = Util.SplitString(GetValue(config, "ScreenshotCaptureDirectories"));
            }
            catch
            {
                if (throwErrors)
                {
                    throw;
                }
            }

            VerifyPaths(throwErrors);
        }
コード例 #6
0
        private void HandleComboBox(TableLayoutPanel tblMain, IConfigurationData config)
        {
            ComboBox cmb = new ComboBox
            {
                Dock = DockStyle.Fill
            };

            string[] items = Util.SplitString(config.AvailableValues);
            List <Tuple <string, string> > cmbDataSource = new List <Tuple <string, string> >();

            for (int i = 0; i < items.Length - 1; i += 2)
            {
                cmbDataSource.Add(new Tuple <string, string>(items[i], items[i + 1]));
            }

            cmb.ValueMember    = "Item1";
            cmb.DataSource     = cmbDataSource;
            cmb.BindingContext = new BindingContext();
            cmb.SelectedItem   = cmbDataSource.FirstOrDefault(x => x.Item2 == config.Value);

            tblMain.Controls.Add(cmb, 1, tblMain.RowStyles.Count - 1);
            m_configValues.Add(new Tuple <IConfigurationData, object>(config, cmb));
        }