@@ -104,19 +104,16 @@ public static async Task<VersionDeploy> GetLastDeploy(string channel)
104104 string baseUrl = BuildBaseUrl ( channel ) ;
105105 string lastDeploy = "" ;
106106
107- using ( HttpClient client = new ( ) )
107+ string deployHistory = await Program . HttpClient . GetStringAsync ( $ "{ baseUrl } /DeployHistory.txt") ;
108+
109+ using ( StringReader reader = new ( deployHistory ) )
108110 {
109- string deployHistory = await client . GetStringAsync ( $ " { baseUrl } /DeployHistory.txt" ) ;
111+ string ? line ;
110112
111- using ( StringReader reader = new ( deployHistory ) )
113+ while ( ( line = await reader . ReadLineAsync ( ) ) is not null )
112114 {
113- string ? line ;
114-
115- while ( ( line = await reader . ReadLineAsync ( ) ) is not null )
116- {
117- if ( line . Contains ( "WindowsPlayer" ) )
118- lastDeploy = line ;
119- }
115+ if ( line . Contains ( "WindowsPlayer" ) )
116+ lastDeploy = line ;
120117 }
121118 }
122119
@@ -132,10 +129,10 @@ public static async Task<VersionDeploy> GetLastDeploy(string channel)
132129
133130 lastDeploy = lastDeploy [ 18 ..] ; // 'version-29fb7cdd06e84001 at 8/23/2022 2:07:27 PM, file version: 0, 542, 100, 5420251, git hash: b98d6b2bea36fa2161f48cca979fb620bb0c24fd ...'
134131 string versionGuid = lastDeploy [ ..lastDeploy . IndexOf ( " at" ) ] ; // 'version-29fb7cdd06e84001'
135-
132+
136133 lastDeploy = lastDeploy [ ( versionGuid . Length + 4 ) ..] ; // '8/23/2022 2:07:27 PM, file version: 0, 542, 100, 5420251, git hash: b98d6b2bea36fa2161f48cca979fb620bb0c24fd ...'
137134 string strTimestamp = lastDeploy [ ..lastDeploy . IndexOf ( ", file" ) ] ; // '8/23/2022 2:07:27 PM'
138-
135+
139136 lastDeploy = lastDeploy [ ( strTimestamp . Length + 16 ) ..] ; // '0, 542, 100, 5420251, git hash: b98d6b2bea36fa2161f48cca979fb620bb0c24fd ...'
140137 string fileVersion = "" ;
141138
@@ -157,11 +154,11 @@ public static async Task<VersionDeploy> GetLastDeploy(string channel)
157154 // convert to traditional version format
158155 fileVersion = fileVersion . Replace ( " " , "" ) . Replace ( ',' , '.' ) ;
159156
160- return new VersionDeploy
161- {
162- VersionGuid = versionGuid ,
163- Timestamp = dtTimestamp ,
164- FileVersion = fileVersion
157+ return new VersionDeploy
158+ {
159+ VersionGuid = versionGuid ,
160+ Timestamp = dtTimestamp ,
161+ FileVersion = fileVersion
165162 } ;
166163 }
167164 }
0 commit comments