22using System . Diagnostics ;
33using System . IO ;
44using System . Linq ;
5+ using System . Text ;
56using System . Threading ;
67using System . Threading . Tasks ;
78using System . Windows ;
1213using _1RM . Model . ProtocolRunner . Default ;
1314using _1RM . Utils ;
1415using _1RM . View . Host ;
16+ using Newtonsoft . Json ;
1517using Shawn . Utils ;
1618using Shawn . Utils . Wpf ;
1719using Stylet ;
@@ -29,10 +31,14 @@ private void ConnectRdpByMstsc(in RDP rdp)
2931 new string ( Path . GetInvalidPathChars ( ) ) ;
3032 rdpFileName = invalid . Aggregate ( rdpFileName , ( current , c ) => current . Replace ( c . ToString ( ) , "" ) ) ;
3133 var rdpFile = Path . Combine ( tmp , rdpFileName + ".rdp" ) ;
34+ var text = rdp . ToRdpConfig ( ) . ToString ( ) ;
3235
3336 // write a .rdp file for mstsc.exe
37+ if ( RetryHelper . Try ( ( ) =>
38+ {
39+ File . WriteAllText ( rdpFile , text ) ;
40+ } , actionOnError : exception => MsAppCenterHelper . Error ( exception ) ) )
3441 {
35- File . WriteAllText ( rdpFile , rdp . ToRdpConfig ( ) . ToString ( ) ) ;
3642 var p = new Process
3743 {
3844 StartInfo =
@@ -76,9 +82,14 @@ private void ConnectRemoteApp(in RdpApp remoteApp)
7682 rdpFileName = invalid . Aggregate ( rdpFileName , ( current , c ) => current . Replace ( c . ToString ( ) , "" ) ) ;
7783 var rdpFile = Path . Combine ( tmp , rdpFileName + ".rdp" ) ;
7884
85+ // write a .rdp file for mstsc.exet.Replace(c.ToString(), ""));
86+ var text = remoteApp . ToRdpConfig ( ) . ToString ( ) ;
7987 // write a .rdp file for mstsc.exe
88+ if ( RetryHelper . Try ( ( ) =>
89+ {
90+ File . WriteAllText ( rdpFile , text ) ;
91+ } , actionOnError : exception => MsAppCenterHelper . Error ( exception ) ) )
8092 {
81- File . WriteAllText ( rdpFile , remoteApp . ToRdpConfig ( ) . ToString ( ) ) ;
8293 var p = new Process
8394 {
8495 StartInfo =
0 commit comments