@@ -166,7 +166,7 @@ public class EnrollState
166166 /// <summary>
167167 /// Permanent JSON session
168168 /// </summary>
169- public bool PermSession { get ; set ; }
169+ // public bool PermSession { get; set; }
170170
171171 /// <summary>
172172 ///
@@ -201,7 +201,7 @@ public override string SecretData
201201 {
202202 get
203203 {
204- if ( PermSession && this . Client != null && this . Client != null )
204+ if ( /* PermSession && */ this . Client != null && this . Client . Session != null )
205205 {
206206 this . SessionData = this . Client . Session . ToString ( ) ;
207207 }
@@ -210,17 +210,17 @@ public override string SecretData
210210 this . SessionData = null ;
211211 }
212212
213- if ( Client != null && Logger != null )
213+ if ( Logger != null )
214214 {
215- Logger . Debug ( "Steam data: {0}, Session:{1}" , SteamData ?? string . Empty , SessionData ?? string . Empty ) ;
215+ Logger . Debug ( "Get Steam data: {0}, Session:{1}" , ( SteamData ?? string . Empty ) . Replace ( " \n " , " " ) . Replace ( " \r " , "" ) , ( SessionData ?? string . Empty ) . Replace ( " \n " , " " ) . Replace ( " \r " , "" ) ) ;
216216 }
217217
218218 // this is the key | serial | deviceid
219219 return base . SecretData
220220 + "|" + Authenticator . ByteArrayToString ( Encoding . UTF8 . GetBytes ( Serial ) )
221221 + "|" + Authenticator . ByteArrayToString ( Encoding . UTF8 . GetBytes ( DeviceId ) )
222222 + "|" + Authenticator . ByteArrayToString ( Encoding . UTF8 . GetBytes ( SteamData ) )
223- + "|" + ( PermSession && string . IsNullOrEmpty ( SessionData ) == false ? Authenticator . ByteArrayToString ( Encoding . UTF8 . GetBytes ( SessionData ) ) : string . Empty ) ;
223+ + "|" + ( /* PermSession && */ string . IsNullOrEmpty ( SessionData ) == false ? Authenticator . ByteArrayToString ( Encoding . UTF8 . GetBytes ( SessionData ) ) : string . Empty ) ;
224224 }
225225 set
226226 {
@@ -232,17 +232,24 @@ public override string SecretData
232232 Serial = ( parts . Length > 1 ? Encoding . UTF8 . GetString ( Authenticator . StringToByteArray ( parts [ 1 ] ) ) : null ) ;
233233 DeviceId = ( parts . Length > 2 ? Encoding . UTF8 . GetString ( Authenticator . StringToByteArray ( parts [ 2 ] ) ) : null ) ;
234234 SteamData = ( parts . Length > 3 ? Encoding . UTF8 . GetString ( Authenticator . StringToByteArray ( parts [ 3 ] ) ) : string . Empty ) ;
235+
235236 if ( string . IsNullOrEmpty ( SteamData ) == false && SteamData [ 0 ] != '{' )
236237 {
237238 // convert old recovation code into SteamData json
238239 SteamData = "{\" revocation_code\" :\" " + SteamData + "\" }" ;
239240 }
240241 string session = ( parts . Length > 4 ? Encoding . UTF8 . GetString ( Authenticator . StringToByteArray ( parts [ 4 ] ) ) : null ) ;
242+
243+ if ( Logger != null )
244+ {
245+ Logger . Debug ( "Set Steam data: {0}, Session:{1}" , ( SteamData ?? string . Empty ) . Replace ( "\n " , " " ) . Replace ( "\r " , "" ) , ( SessionData ?? string . Empty ) . Replace ( "\n " , " " ) . Replace ( "\r " , "" ) ) ;
246+ }
247+
241248 if ( string . IsNullOrEmpty ( session ) == false )
242249 {
243250 SessionData = session ;
244251 }
245- PermSession = ( SessionData != null ) ;
252+ // PermSession = (SessionData != null);
246253 }
247254 else
248255 {
@@ -251,7 +258,7 @@ public override string SecretData
251258 DeviceId = null ;
252259 SteamData = null ;
253260 SessionData = null ;
254- PermSession = false ;
261+ // PermSession = false;
255262 }
256263 }
257264 }
@@ -266,6 +273,10 @@ public SteamClient GetClient()
266273 {
267274 if ( this . Client == null )
268275 {
276+ if ( Logger != null )
277+ {
278+ Logger . Debug ( "Create new SteamClient {0}" , ( this . SessionData ?? string . Empty ) . Replace ( "\n " , " " ) . Replace ( "\r " , "" ) ) ;
279+ }
269280 this . Client = new SteamClient ( this , this . SessionData ) ;
270281 }
271282
0 commit comments