@@ -57,7 +57,7 @@ public partial class FormMain : Form
5757 private readonly FormLogSession logSessionLink ;
5858 private readonly FormPings pingsLink ;
5959 private readonly FormTeams teamsLink ;
60- private readonly Timer timerFailedLogsReupload = new ( )
60+ private readonly Timer timerFailedLogsReuploadAndRePing = new ( )
6161 {
6262 Enabled = false ,
6363 Interval = 900000 ,
@@ -324,7 +324,7 @@ internal FormMain()
324324 logSessionLink . checkBoxOnlySuccess . CheckedChanged += logSessionLink . CheckBoxOnlySuccess_CheckedChanged ;
325325 logSessionLink . checkBoxSaveToFile . CheckedChanged += logSessionLink . CheckBoxSaveToFile_CheckedChanged ;
326326 discordWebhooksLink . checkBoxShortenThousands . CheckedChanged += discordWebhooksLink . CheckBoxShortenThousands_CheckedChanged ;
327- timerFailedLogsReupload . Elapsed += TimerFailedLogsReupload_Elapsed ;
327+ timerFailedLogsReuploadAndRePing . Elapsed += TimerFailedLogsReuploadAndRePingElapsed ;
328328 timerCheckUpdate . Elapsed += TimerCheckUpdate_Elapsed ;
329329 ApplicationSettings . Current . Save ( ) ;
330330 }
@@ -634,6 +634,7 @@ private async Task StartUpAndCommandArgs()
634634 if ( args . Length <= 1 )
635635 {
636636 HandleLogReuploads ( ) ;
637+ HandleWingmanRePings ( ) ;
637638 return ;
638639 }
639640 var argIndex = - 1 ;
@@ -667,32 +668,33 @@ private async Task StartUpAndCommandArgs()
667668 if ( File . Exists ( arg ) && ( arg . EndsWith ( ".evtc" ) || arg . EndsWith ( ".zevtc" ) ) )
668669 {
669670 var archived = false ;
670- var zipfilelocation = arg ;
671+ var zipFileLocation = arg ;
671672 if ( ! arg . EndsWith ( ".zevtc" ) )
672673 {
673- zipfilelocation = $ "{ ApplicationSettings . LocalDir } { Path . GetFileNameWithoutExtension ( arg ) } .zevtc";
674- using var zipfile = ZipFile . Open ( zipfilelocation , ZipArchiveMode . Create ) ;
675- zipfile . CreateEntryFromFile ( arg , Path . GetFileName ( arg ) ) ;
674+ zipFileLocation = $ "{ ApplicationSettings . LocalDir } { Path . GetFileNameWithoutExtension ( arg ) } .zevtc";
675+ using var zipFile = ZipFile . Open ( zipFileLocation , ZipArchiveMode . Create ) ;
676+ zipFile . CreateEntryFromFile ( arg , Path . GetFileName ( arg ) ) ;
676677 archived = true ;
677678 }
678679 try
679680 {
680- await HttpUploadLogAsync ( zipfilelocation , defaultPostData ) ;
681+ await HttpUploadLogAsync ( zipFileLocation , defaultPostData ) ;
681682 }
682683 catch
683684 {
684- AddToText ( $ ">>> Unknown error uploading a log: { zipfilelocation } ") ;
685+ AddToText ( $ ">>> Unknown error uploading a log: { zipFileLocation } ") ;
685686 }
686687 finally
687688 {
688689 if ( archived )
689690 {
690- File . Delete ( zipfilelocation ) ;
691+ File . Delete ( zipFileLocation ) ;
691692 }
692693 }
693694 }
694695 }
695696 HandleLogReuploads ( ) ;
697+ HandleWingmanRePings ( ) ;
696698 }
697699
698700 private async Task ValidateGw2Tokens ( )
@@ -787,19 +789,19 @@ private async Task HttpUploadLogAsync(string file, Dictionary<string, string> po
787789 if ( reportJson ? . Error ? . Contains ( "EI Failure" ) ?? false )
788790 {
789791 AddToText ( ">:> Due to an Elite Insights error while processing the log file, it will not be automatically reuploaded. Is the log file corrupted?" ) ;
790- LogReuploader . RemovedLogAndSave ( file ) ;
792+ LogReuploader . RemoveLogAndSave ( file ) ;
791793 return ;
792794 }
793795 if ( reportJson ? . Error ? . Contains ( "An identical file was uploaded recently" ) ?? false )
794796 {
795797 AddToText ( ">:> To prevent same log regeneration, the upload try will not be automatically reuploaded." ) ;
796- LogReuploader . RemovedLogAndSave ( file ) ;
798+ LogReuploader . RemoveLogAndSave ( file ) ;
797799 return ;
798800 }
799801 if ( reportJson ? . Error ? . Contains ( "Encounter is too short" ) ?? false )
800802 {
801803 AddToText ( ">:> Encounter is too short to generate a valid log, the upload try will not be automatically reuploaded." ) ;
802- LogReuploader . RemovedLogAndSave ( file ) ;
804+ LogReuploader . RemoveLogAndSave ( file ) ;
803805 return ;
804806 }
805807 }
@@ -827,7 +829,7 @@ private async Task HttpUploadLogAsync(string file, Dictionary<string, string> po
827829 }
828830 LogReuploader . FailedLogs . Add ( file ) ;
829831 LogReuploader . SaveFailedLogs ( ) ;
830- EnsureReuploadTimerStart ( ) ;
832+ EnsureReuploadAndRePingTimerStart ( ) ;
831833 return ;
832834 }
833835 AddToText ( $ ">:> Unable to upload file { Path . GetFileName ( file ) } , dps.report responded with an non-ok status code ({ ( int ) responseMessage . StatusCode } ).") ;
@@ -924,7 +926,7 @@ private async Task HttpUploadLogAsync(string file, Dictionary<string, string> po
924926 // report success
925927 AddToText ( $ ">:> { Path . GetFileName ( file ) } successfully uploaded.") ;
926928 // remove from failed logs if present
927- LogReuploader . RemovedLogAndSave ( file ) ;
929+ LogReuploader . RemoveLogAndSave ( file ) ;
928930 }
929931 catch ( Exception e )
930932 {
@@ -954,7 +956,7 @@ private async Task HandleQuickLogUploadRetry(string file, Dictionary<string, str
954956 AddToText ( $ ">:> Upload retry failed 4 times for { Path . GetFileName ( file ) } , will try again during log reupload timer.") ;
955957 LogReuploader . FailedLogs . Add ( file ) ;
956958 LogReuploader . SaveFailedLogs ( ) ;
957- EnsureReuploadTimerStart ( ) ;
959+ EnsureReuploadAndRePingTimerStart ( ) ;
958960 }
959961 else
960962 {
@@ -984,11 +986,7 @@ private async Task ExecuteAllDiscordWebhooks(DpsReportJson reportJson, List<LogP
984986 {
985987 if ( logSessionLink . SessionRunning )
986988 {
987- if ( logSessionLink . checkBoxOnlySuccess . Checked && ( reportJson . Encounter . Success ?? false ) )
988- {
989- SessionLogs . Add ( reportJson ) ;
990- }
991- else if ( ! logSessionLink . checkBoxOnlySuccess . Checked )
989+ if ( ( logSessionLink . checkBoxOnlySuccess . Checked && ( reportJson . Encounter . Success ?? false ) ) || ! logSessionLink . checkBoxOnlySuccess . Checked )
992990 {
993991 SessionLogs . Add ( reportJson ) ;
994992 }
@@ -1045,7 +1043,23 @@ private async Task CrossUploadToWingman(string file, DpsReportJsonExtraJson extr
10451043 {
10461044 return ;
10471045 }
1048- AddToText ( await Gw2WingmanUploader . Upload ( file , extraJson ) ) ;
1046+ var resultText = await Gw2WingmanUploader . Upload ( file , extraJson ) ;
1047+ if ( resultText . Contains ( "fail" ) && ! resultText . Contains ( "exists" ) )
1048+ {
1049+ WingmanRePing . LogsToPing . Add ( new WingmanPingInfo
1050+ {
1051+ FilePath = file ,
1052+ TriggerId = extraJson . TriggerId ,
1053+ UploadedBy = extraJson . RecordedByAccountName ,
1054+ } ) ;
1055+ WingmanRePing . SaveLogsToPing ( ) ;
1056+ EnsureReuploadAndRePingTimerStart ( ) ;
1057+ }
1058+ else
1059+ {
1060+ WingmanRePing . RemoveLogAndSave ( file ) ;
1061+ }
1062+ AddToText ( resultText ) ;
10491063 }
10501064
10511065 internal bool IsTwitchConnectionNull ( ) => chatConnect is null ;
@@ -1706,18 +1720,19 @@ private void TimerCheckUpdate_Elapsed(object sender, EventArgs e)
17061720 _ = NewReleaseCheckAsync ( false , true ) ;
17071721 }
17081722
1709- private void TimerFailedLogsReupload_Elapsed ( object sender , EventArgs e )
1723+ private void TimerFailedLogsReuploadAndRePingElapsed ( object sender , EventArgs e )
17101724 {
17111725 HandleLogReuploads ( ) ;
1726+ HandleWingmanRePings ( ) ;
17121727 }
17131728
1714- private void EnsureReuploadTimerStart ( )
1729+ private void EnsureReuploadAndRePingTimerStart ( )
17151730 {
1716- if ( timerFailedLogsReupload . Enabled )
1731+ if ( timerFailedLogsReuploadAndRePing . Enabled )
17171732 {
17181733 return ;
17191734 }
1720- timerFailedLogsReupload . Start ( ) ;
1735+ timerFailedLogsReuploadAndRePing . Start ( ) ;
17211736 }
17221737
17231738 private void HandleLogReuploads ( )
@@ -1731,6 +1746,17 @@ private void HandleLogReuploads()
17311746 AddToText ( ">:> Log reuploading has ended." ) ;
17321747 }
17331748
1749+ private void HandleWingmanRePings ( )
1750+ {
1751+ if ( WingmanRePing . LogsToPing . Count == 0 )
1752+ {
1753+ return ;
1754+ }
1755+ AddToText ( $ ">:> Starting wingman re-pings of { WingmanRePing . LogsToPing . Count } logs...") ;
1756+ WingmanRePing . ProcessLogs ( semaphore , CrossUploadToWingman ) ;
1757+ AddToText ( ">:> Wingman re-pings has been completed." ) ;
1758+ }
1759+
17341760 private void ComboBoxMaxUploads_SelectedIndexChanged ( object sender , EventArgs e )
17351761 {
17361762 if ( ! int . TryParse ( comboBoxMaxUploads . Text , out var threads ) )
0 commit comments