@@ -2096,6 +2096,7 @@ void RefreshBuildReports()
20962096 bool collectedBuildTime = false ;
20972097
20982098 bool gotProjectPath = false ;
2099+ bool hasTimeStamps = false ;
20992100
21002101 // TODO cleanup here
21012102 while ( ! sr . EndOfStream )
@@ -2108,8 +2109,23 @@ void RefreshBuildReports()
21082109 currentBuildReportProjectPath = line ;
21092110 gotProjectPath = false ;
21102111 }
2111- if ( line == "-projectPath" ) gotProjectPath = true ;
21122112
2113+ // if have timestamps, trim until 2nd | char at start
2114+
2115+ // check arguments
2116+ if ( line . IndexOf ( "-projectPath" ) > - 1 ) gotProjectPath = true ;
2117+ if ( hasTimeStamps == false && line . IndexOf ( "-timestamps" ) > - 1 )
2118+ {
2119+ hasTimeStamps = true ;
2120+ // need to fix projectpath then
2121+ currentBuildReportProjectPath = currentBuildReportProjectPath . Substring ( currentBuildReportProjectPath . IndexOf ( "|" , currentBuildReportProjectPath . IndexOf ( "|" ) + 1 ) + 1 ) ;
2122+ }
2123+
2124+ // remove timestamp from line, NOTE if | character exists somewhere else than timestamp, causes issue
2125+ if ( hasTimeStamps && line . IndexOf ( "|" ) > - 1 )
2126+ {
2127+ line = line . Substring ( line . IndexOf ( "|" , line . IndexOf ( "|" ) + 1 ) + 1 ) . Trim ( ) ;
2128+ }
21132129
21142130 // build report starts
21152131 if ( collectRows == false && line . IndexOf ( "Used Assets and files from the Resources folder, sorted by uncompressed size:" ) == 0 )
@@ -2151,14 +2167,19 @@ void RefreshBuildReports()
21512167 {
21522168 // it wasnt clean build, no report
21532169 if ( singleReport == null ) continue ;
2170+ int start = line . IndexOf ( "(" ) + 1 ;
2171+ int end = line . IndexOf ( " ms)" , start ) ;
21542172
2155- var ms = line . Substring ( line . IndexOf ( "(" ) + 1 , line . IndexOf ( ")" ) - line . IndexOf ( "(" ) - 1 ) . Trim ( ) . Replace ( " ms" , "" ) ;
2156- singleReport . ElapsedTimeMS = long . Parse ( ms ) ;
2157- collectedBuildTime = true ;
2173+ if ( start > 0 && end > start )
2174+ {
2175+ string numberString = line . Substring ( start , end - start ) ;
2176+ singleReport . ElapsedTimeMS = long . Parse ( numberString ) ;
2177+ collectedBuildTime = true ;
2178+ }
21582179
21592180 if ( string . IsNullOrEmpty ( currentBuildReportProjectPath ) == false )
21602181 {
2161- // get streamingassets folder size and add to report, NOTE need to recalculate sizes then?
2182+ // get streamingassets folder size and add as last item to report, NOTE need to recalculate sizes then?
21622183 string streamingAssetPath = Path . Combine ( currentBuildReportProjectPath , "Assets" , "StreamingAssets" ) ;
21632184 var streamingAssetFolderSize = Tools . GetFolderSizeInBytes ( streamingAssetPath ) ;
21642185 singleReport . Stats . Insert ( singleReport . Stats . Count - 1 , new BuildReportItem ( ) { Category = "StreamingAssets" , Size = Tools . GetBytesReadable ( streamingAssetFolderSize ) } ) ;
@@ -2214,8 +2235,10 @@ void RefreshBuildReports()
22142235
22152236 if ( collectStats == true )
22162237 {
2238+
2239+ //if (hasTimeStamps)
22172240 var line2 = line . Trim ( ) ;
2218- // get 2xspace after category name
2241+ // get 2x space after category name
22192242 var space1 = line2 . IndexOf ( " " ) ;
22202243 // get tab after first size
22212244 var space2 = line2 . IndexOf ( '\t ' ) ;
0 commit comments