Exemplo n.º 1
0
 public VersionHandler(DataAccess access, IDataSourceAdapter adapter, AppConfiguration appConfig)
 {
     DataAccess  = access;
     m_adapter   = adapter;
     m_appConfig = appConfig;
 }
Exemplo n.º 2
0
 public UtilityHandler(IWin32Window parent, AppConfiguration config, ISourcePortData utility)
 {
     m_parent  = parent;
     m_config  = config;
     m_utility = utility;
 }
Exemplo n.º 3
0
        private async void Initialize()
        {
            string     dataSource = Path.Combine(LauncherPath.GetDataDirectory(), DbDataSourceAdapter.DatabaseFileName);
            DataAccess access     = new DataAccess(new SqliteDatabaseAdapter(), DbDataSourceAdapter.CreateConnectionString(dataSource));

            m_versionHandler = new VersionHandler(access, DbDataSourceAdapter.CreateAdapter(true), AppConfiguration);

            if (m_versionHandler.UpdateRequired())
            {
                m_versionHandler.UpdateProgress += handler_UpdateProgress;

                m_progressBarUpdate = CreateProgressBar("Updating...", ProgressBarStyle.Continuous);
                ProgressBarStart(m_progressBarUpdate);

                await Task.Run(() => ExecuteVersionUpdate());

                ProgressBarEnd(m_progressBarUpdate);

                AppConfiguration.Refresh(); //We have to refresh here because a column may have been added to the Configuration table
            }

            try
            {
                //Only set location and window state if the location is valid, either way we always set Width, Height, and splitter values
                if (ValidatePosition(AppConfiguration))
                {
                    WindowState = AppConfiguration.WindowState;

                    if (WindowState != FormWindowState.Maximized)
                    {
                        StartPosition = FormStartPosition.Manual;
                        Location      = new Point(AppConfiguration.AppX, AppConfiguration.AppY);
                    }
                }

                // Save the height and set after splitter, otherwise splitter resizing will be incorrect
                int saveWidth  = Width;
                int saveHeight = Height;

                Width  = AppConfiguration.AppWidth;
                Height = AppConfiguration.AppHeight;

                splitTopBottom.SplitterDistance = AppConfiguration.SplitTopBottom;
                splitLeftRight.SplitterDistance = AppConfiguration.SplitLeftRight;

                // If the app was closed in the maximized state then the width and height are maxed out
                // This causes the window to take up the full screen even when set to normal state
                if (WindowState == FormWindowState.Maximized)
                {
                    Width  = saveWidth;
                    Height = saveHeight;
                }
            }
            catch (DirectoryNotFoundException ex)
            {
                MessageBox.Show(this, string.Format("The directory specified in your settings was incorrect: '{0}'", ex.Message),
                                "Configuration Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tblMain.Enabled = false;
                return;
            }

            if (AppConfiguration.CleanTemp)
            {
                CleanTempDirectory();
            }

            DirectoryDataSourceAdapter = new DirectoryDataSourceAdapter(AppConfiguration.GameFileDirectory);
            DataCache.Instance.Init(DataSourceAdapter);
            DataCache.Instance.AppConfiguration.GameFileViewTypeChanged += AppConfiguration_GameFileViewTypeChanged;

            SetupTabs();
            RebuildUtilityToolStrip();
            BuildUtilityToolStrip();

            m_downloadView           = new DownloadView();
            m_downloadView.UserPlay += DownloadView_UserPlay;
            m_downloadHandler        = new DownloadHandler(AppConfiguration.TempDirectory, m_downloadView);

            ctrlAssociationView.Initialize(DataSourceAdapter, AppConfiguration);
            ctrlAssociationView.FileDeleted        += ctrlAssociationView_FileDeleted;
            ctrlAssociationView.FileOrderChanged   += ctrlAssociationView_FileOrderChanged;
            ctrlAssociationView.RequestScreenshots += CtrlAssociationView_RequestScreenshots;

            m_splash.Close();

            await CheckFirstInit();

            UpdateLocal();

            SetupSearchFilters();

            await Task.Run(() => CheckForAppUpdate());
        }
Exemplo n.º 4
0
        private static GameFilePlayAdapter CreatePlayAdapter(PlayForm form, EventHandler processExited, AppConfiguration appConfig)
        {
            GameFilePlayAdapter playAdapter = new GameFilePlayAdapter();

            playAdapter.IWad            = form.SelectedIWad;
            playAdapter.Map             = form.SelectedMap;
            playAdapter.Skill           = form.SelectedSkill;
            playAdapter.Record          = form.Record;
            playAdapter.SpecificFiles   = form.SpecificFiles;
            playAdapter.AdditionalFiles = form.GetAdditionalFiles().ToArray();
            playAdapter.PlayDemo        = form.PlayDemo;
            playAdapter.ExtraParameters = form.ExtraParameters;
            playAdapter.SaveStatistics  = form.SaveStatistics;
            playAdapter.ProcessExited  += processExited;
            if (form.SelectedDemo != null)
            {
                playAdapter.PlayDemoFile = Path.Combine(appConfig.DemoDirectory.GetFullPath(), form.SelectedDemo.FileName);
            }
            return(playAdapter);
        }
Exemplo n.º 5
0
 public VersionHandler(DoomLauncher.DataAccess access, IDataSourceAdapter adapter, AppConfiguration appConfig)
 {
     this.DataAccess  = access;
     this.m_adapter   = adapter;
     this.m_appConfig = appConfig;
 }