private void DownloadProfileDataHelper( CDlgUpdateProfile updateDlg )
        {
            DialogResult res = updateDlg.ShowDialog();

            if( updateDlg.Error != null ) {
                AddStatus( string.Format( GlobalStrings.MainForm_ErrorDownloadingProfileData, updateDlg.UseHtml ? "HTML" : "XML" ) );
                MessageBox.Show( string.Format( GlobalStrings.MainForm_ErrorDowloadingProfile, updateDlg.Error.Message ), GlobalStrings.DBEditDlg_Error, MessageBoxButtons.OK, MessageBoxIcon.Error );
            } else {
                if( res == DialogResult.Abort || res == DialogResult.Cancel ) {
                    AddStatus( GlobalStrings.MainForm_DownloadAborted );
                } else {
                    if( updateDlg.Failover ) {
                        AddStatus( GlobalStrings.MainForm_XMLDownloadFailed );
                    }
                    if( updateDlg.Fetched == 0 ) {
                        MessageBox.Show( GlobalStrings.MainForm_NoGameDataFound, GlobalStrings.DBEditDlg_Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning );
                        AddStatus( GlobalStrings.MainForm_NoGamesInDownload );
                    } else {
                        MakeChange( true );
                        if( currentProfile.IgnoreExternal ) {
                            AddStatus( string.Format( GlobalStrings.MainForm_DownloadedGames, updateDlg.Fetched, updateDlg.Added, updateDlg.UseHtml ? "HTML" : "XML" ) );
                        } else {
                            AddStatus( string.Format( GlobalStrings.MainForm_DownloadedGamesWithExternal, updateDlg.Fetched, updateDlg.Added, updateDlg.Removed, updateDlg.UseHtml ? "HTML" : "XML" ) );
                        }

                        FullListRefresh();
                    }
                }
            }
        }
 private void DownloadProfileData( Int64 steamId, bool overwrite, SortedSet<int> ignore, bool ignoreDlc, bool ignoreExternal )
 {
     CDlgUpdateProfile updateDlg = new CDlgUpdateProfile( gameData, steamId, overwrite, ignore, ignoreDlc, ignoreExternal );
     DownloadProfileDataHelper( updateDlg );
 }
 private void DownloadProfileData( string customUrl, bool overwrite, SortedSet<int> ignore, bool ignoreDlc, bool ignoreExternal )
 {
     CDlgUpdateProfile updateDlg = new CDlgUpdateProfile( gameData, customUrl, overwrite, ignore, ignoreDlc, ignoreExternal );
     DownloadProfileDataHelper( updateDlg );
 }
Beispiel #4
0
        /// <summary>
        /// Updates the game list for the loaded profile.
        /// </summary>
        void UpdateLibrary() {
            if( currentProfile == null ) return;

            Cursor = Cursors.WaitCursor;

            bool success = false;

            // First, try to update via local config files, if they're enabled
            if( currentProfile.LocalUpdate ) {
                try {
                    int newApps = 0;
                    AppTypes appFilter = currentProfile.IncludeUnknown ? AppTypes.InclusionUnknown : AppTypes.InclusionNormal;
                    int totalApps = currentProfile.GameData.UpdateGameListFromOwnedPackageInfo( currentProfile.SteamID64, currentProfile.IgnoreList, appFilter, out newApps );
                    AddStatus( string.Format( GlobalStrings.MainForm_Status_LocalUpdate, totalApps, newApps ) );
                    success = true;
                } catch( Exception e ) {
                    MessageBox.Show( string.Format( GlobalStrings.MainForm_Msg_LocalUpdateError, e.Message ), GlobalStrings.Gen_Error, MessageBoxButtons.OK, MessageBoxIcon.Warning );
                    Program.Logger.WriteException( GlobalStrings.MainForm_Log_ExceptionLocalUpdate, e );
                    AddStatus( GlobalStrings.MainForm_Status_LocalUpdateFailed );
                    success = false;
                }
            }
            if( success ) {
                MakeChange( true );
                FullListRefresh();
            } else if( currentProfile.WebUpdate ) {
                try {
                    CDlgUpdateProfile updateDlg = new CDlgUpdateProfile( currentProfile.GameData, currentProfile.SteamID64, currentProfile.OverwriteOnDownload, currentProfile.IgnoreList, currentProfile.IncludeUnknown );
                    DialogResult res = updateDlg.ShowDialog();

                    if( updateDlg.Error != null ) {
                        Program.Logger.WriteException( GlobalStrings.MainForm_Log_ExceptionWebUpdateDialog, updateDlg.Error );
                        AddStatus( string.Format( GlobalStrings.MainForm_ErrorDownloadingProfileData, updateDlg.UseHtml ? "HTML" : "XML" ) );
                        MessageBox.Show( string.Format( GlobalStrings.MainForm_ErrorDowloadingProfile, updateDlg.Error.Message ), GlobalStrings.DBEditDlg_Error, MessageBoxButtons.OK, MessageBoxIcon.Error );
                    } else {
                        if( res == DialogResult.Abort || res == DialogResult.Cancel ) {
                            AddStatus( GlobalStrings.MainForm_DownloadAborted );
                        } else {
                            if( updateDlg.Failover ) {
                                AddStatus( GlobalStrings.MainForm_XMLDownloadFailed );
                            }
                            if( updateDlg.Fetched == 0 ) {
                                MessageBox.Show( GlobalStrings.MainForm_NoGameDataFound, GlobalStrings.Gen_Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning );
                                AddStatus( GlobalStrings.MainForm_NoGamesInDownload );
                            } else {
                                MakeChange( true );
                                AddStatus( string.Format( GlobalStrings.MainForm_DownloadedGames, updateDlg.Fetched, updateDlg.Added, updateDlg.UseHtml ? "HTML" : "XML" ) );
                                FullListRefresh();
                            }
                        }
                    }
                } catch( Exception e ) {
                    Program.Logger.WriteException( GlobalStrings.MainForm_Log_ExceptionWebUpdate, e );
                    MessageBox.Show( string.Format( GlobalStrings.MainForm_ErrorDowloadingProfile, e.Message ), GlobalStrings.DBEditDlg_Error, MessageBoxButtons.OK, MessageBoxIcon.Error );
                    AddStatus( GlobalStrings.MainForm_DownloadFailed );
                }
            }

            Cursor = Cursors.Default;

        }