public void InsertIWad(IIWadData iwad)
        {
            List <DbParameter> parameters;
            string             insert = InsertStatement("IWads", iwad, new string[] { "IWadID" }, out parameters);

            DataAccess.ExecuteNonQuery(insert, parameters);
        }
Пример #2
0
        private void SetDefaultSelections()
        {
            int    port  = (int)AppConfiguration.GetTypedConfigValue(ConfigType.DefaultSourcePort, typeof(int));
            int    iwad  = (int)AppConfiguration.GetTypedConfigValue(ConfigType.DefaultIWad, typeof(int));
            string skill = (string)AppConfiguration.GetTypedConfigValue(ConfigType.DefaultSkill, typeof(string));

            ISourcePort sourcePort = DataSourceAdapter.GetSourcePorts().FirstOrDefault(x => x.SourcePortID == port);

            if (sourcePort != null)
            {
                m_currentPlayForm.SelectedSourcePort = sourcePort;
            }

            IIWadData iwadSource = DataSourceAdapter.GetIWads().FirstOrDefault(x => x.IWadID == Convert.ToInt32(iwad));

            if (iwadSource != null)
            {
                GameFileGetOptions      options      = new GameFileGetOptions(new GameFileSearchField(GameFileFieldType.GameFileID, iwadSource.GameFileID.Value.ToString()));
                IEnumerable <IGameFile> gameFileIwad = DataSourceAdapter.GetGameFiles(options);
                if (gameFileIwad.Any())
                {
                    m_currentPlayForm.SelectedIWad = gameFileIwad.First();
                }
            }

            if (skill != null)
            {
                m_currentPlayForm.SelectedSkill = skill;
            }
        }
Пример #3
0
        private void SetupPlayForm(IGameFile gameFile)
        {
            m_currentPlayForm = new PlayForm(AppConfiguration, DataSourceAdapter);
            m_currentPlayForm.SaveSettings += m_currentPlayForm_SaveSettings;
            m_currentPlayForm.OnPreviewLaunchParameters += m_currentPlayForm_OnPreviewLaunchParameters;
            m_currentPlayForm.StartPosition              = FormStartPosition.CenterParent;

            List <ITabView> views = GetAdditionalTabViews();

            if (gameFile != null)
            {
                gameFile = DataSourceAdapter.GetGameFile(gameFile.FileName); //this file came from the grid, which does not have all info populated to save perfomance
            }
            m_currentPlayForm.Initialize(views, gameFile);

            SetDefaultSelections();

            if (gameFile != null)
            {
                IIWadData iwad = DataSourceAdapter.GetIWad(gameFile.GameFileID.Value);

                if (iwad != null)
                {
                    m_currentPlayForm.SelectedIWad = gameFile;
                }

                if (gameFile.SourcePortID.HasValue)
                {
                    m_currentPlayForm.SelectedSourcePort = DataSourceAdapter.GetSourcePort(gameFile.SourcePortID.Value);
                }

                if (gameFile.IWadID.HasValue)
                {
                    m_currentPlayForm.SelectedIWad = gameFile;
                    m_currentPlayForm.SelectedIWad = DataSourceAdapter.GetGameFileIWads().FirstOrDefault(x => x.IWadID == gameFile.IWadID);
                }

                if (!string.IsNullOrEmpty(gameFile.SettingsMap))
                {
                    m_currentPlayForm.SelectedMap = gameFile.SettingsMap;
                }
                if (!string.IsNullOrEmpty(gameFile.SettingsSkill))
                {
                    m_currentPlayForm.SelectedSkill = gameFile.SettingsSkill;
                }
                if (!string.IsNullOrEmpty(gameFile.SettingsExtraParams))
                {
                    m_currentPlayForm.ExtraParameters = gameFile.SettingsExtraParams;
                }
                if (!string.IsNullOrEmpty(gameFile.SettingsSpecificFiles))
                {
                    m_currentPlayForm.SpecificFiles = gameFile.SettingsSpecificFiles.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                }
            }

            m_currentPlayForm.InitializeComplete();
        }
Пример #4
0
        public override bool Equals(object obj)
        {
            IIWadData iwad = obj as IIWadData;

            if (iwad != null)
            {
                return(iwad.FileName == FileName);
            }

            return(false);
        }
        public void UpdateIWad(IIWadData iwad)
        {
            string             update     = "update IWads set FileName = @FileName, Name = @Name, GameFileID = @GameFileID where IWadID = @IWadID";
            List <DbParameter> parameters = new List <DbParameter>();

            parameters.Add(DataAccess.DbAdapter.CreateParameter("IWadID", iwad.IWadID));
            parameters.Add(DataAccess.DbAdapter.CreateParameter("FileName", iwad.FileName));
            parameters.Add(DataAccess.DbAdapter.CreateParameter("Name", iwad.Name));
            parameters.Add(DataAccess.DbAdapter.CreateParameter("GameFileID", iwad.GameFileID.HasValue ? iwad.GameFileID : (object)DBNull.Value));

            DataAccess.ExecuteNonQuery(update, parameters);
        }
Пример #6
0
        private string GetGameName()
        {
            IIWadData iwad = cmbGame.SelectedItem as IIWadData;

            string ext = Path.GetExtension(iwad.Name);

            if (!string.IsNullOrEmpty(ext))
            {
                return(iwad.Name.Replace(ext, string.Empty));
            }
            else
            {
                return(iwad.Name);
            }
        }
Пример #7
0
        private int?GetIWad(string iwad)
        {
            iwad = Path.GetFileNameWithoutExtension(iwad);
            IIWadData data = m_iwads.FirstOrDefault(x => Path.GetFileNameWithoutExtension(x.FileName).Equals(iwad, StringComparison.InvariantCultureIgnoreCase));

            if (data == null)
            {
                m_errors.Add(string.Format("Could not find IWAD - {0}", iwad));
            }

            if (data != null)
            {
                return(data.IWadID);
            }

            return(null);
        }
 public void DeleteIWad(IIWadData iwad)
 {
     DataAccess.ExecuteNonQuery(string.Format("delete from IWads where IWadID = {0}", iwad.IWadID));
 }
Пример #9
0
 public void DeleteIWad(IIWadData iwad)
 {
     throw new NotSupportedException();
 }
Пример #10
0
 public void InsertIWad(IIWadData iwad)
 {
     throw new NotSupportedException();
 }
Пример #11
0
 public void UpdateIWad(IIWadData iwad)
 {
     throw new NotImplementedException();
 }
Пример #12
0
 public void InsertIWad(IIWadData iwad)
 {
     throw new NotImplementedException();
 }
Пример #13
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;

                IIWadData iwad = m_adapter.GetIWad(gameProfile.GameFileID.Value);

                if (iwad != null)
                {
                    SelectedIWad = GameFile;
                }

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

                if (gameProfile.IWadID.HasValue)
                {
                    SelectedIWad = GameFile;
                    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();

            if (SelectedIWad != null && SelectedIWad.Equals(GameFile))
            {
                cmbIwad.Enabled = false;
            }
        }