@@ -244,6 +244,17 @@ void FilterUnitys()
244
244
}
245
245
}
246
246
247
+ void FilterBuildReport ( )
248
+ {
249
+ _filterString = txtSearchBoxBuildReport . Text ;
250
+ ICollectionView collection = CollectionViewSource . GetDefaultView ( gridBuildReport . ItemsSource ) ;
251
+ collection . Filter = BuildReportFilter ;
252
+ //if (gridBuildReport.Items.Count > 0)
253
+ //{
254
+ // gridBuildReport.SelectedIndex = 0;
255
+ //}
256
+ }
257
+
247
258
private bool ProjectFilter ( object item )
248
259
{
249
260
Project proj = item as Project ;
@@ -262,6 +273,12 @@ private bool UnitysFilter(object item)
262
273
return ( unity . Version . IndexOf ( _filterString , 0 , StringComparison . CurrentCultureIgnoreCase ) != - 1 ) ;
263
274
}
264
275
276
+ private bool BuildReportFilter ( object item )
277
+ {
278
+ BuildReportItem reportItem = item as BuildReportItem ;
279
+ return ( reportItem . Path . IndexOf ( _filterString , 0 , StringComparison . CurrentCultureIgnoreCase ) != - 1 ) ;
280
+ }
281
+
265
282
void LoadSettings ( )
266
283
{
267
284
// form size
@@ -736,6 +753,18 @@ private void OnWindowKeyDown(object sender, KeyEventArgs e)
736
753
break ;
737
754
}
738
755
break ;
756
+
757
+ case 3 : // Tools
758
+
759
+ switch ( e . Key )
760
+ {
761
+ case Key . Escape : // clear search
762
+ txtSearchBoxBuildReport . Text = "" ;
763
+ break ;
764
+ default : // any key
765
+ break ;
766
+ }
767
+ break ;
739
768
default :
740
769
break ;
741
770
}
@@ -1706,7 +1735,14 @@ private void BtnRefreshBuildReport_Click(object sender, RoutedEventArgs e)
1706
1735
if ( File . Exists ( logFile ) == false ) return ;
1707
1736
1708
1737
// NOTE this can fail on a HUGE log file
1709
- string [ ] rows = File . ReadAllLines ( logFile ) ;
1738
+ FileStream fs = new FileStream ( logFile , FileMode . Open , FileAccess . Read , FileShare . ReadWrite ) ;
1739
+ StreamReader sr = new StreamReader ( fs ) ;
1740
+ List < string > rows = new List < string > ( ) ;
1741
+ while ( ! sr . EndOfStream )
1742
+ {
1743
+ rows . Add ( sr . ReadLine ( ) ) ;
1744
+ }
1745
+
1710
1746
1711
1747
if ( rows == null )
1712
1748
{
@@ -1717,7 +1753,7 @@ private void BtnRefreshBuildReport_Click(object sender, RoutedEventArgs e)
1717
1753
int startRow = - 1 ;
1718
1754
int endRow = - 1 ;
1719
1755
1720
- for ( int i = 0 , len = rows . Length ; i < len ; i ++ )
1756
+ for ( int i = 0 , len = rows . Count ; i < len ; i ++ )
1721
1757
{
1722
1758
// get current project path from log file
1723
1759
if ( rows [ i ] == "-projectPath" )
@@ -1729,14 +1765,14 @@ private void BtnRefreshBuildReport_Click(object sender, RoutedEventArgs e)
1729
1765
if ( string . IsNullOrEmpty ( latestBuildReportProjectPath ) ) Console . WriteLine ( "Failed to parse project path from logfile.." ) ;
1730
1766
1731
1767
// loop backwards to find latest report
1732
- for ( int i = rows . Length - 1 ; i >= 0 ; i -- )
1768
+ for ( int i = rows . Count - 1 ; i >= 0 ; i -- )
1733
1769
{
1734
1770
// find start of build report
1735
1771
if ( rows [ i ] . IndexOf ( "Used Assets and files from the Resources folder, sorted by uncompressed size:" ) == 0 )
1736
1772
{
1737
1773
startRow = i + 1 ;
1738
1774
// find end of report
1739
- for ( int k = i ; k < rows . Length ; k ++ )
1775
+ for ( int k = i , len = rows . Count ; k < len ; k ++ )
1740
1776
{
1741
1777
if ( rows [ k ] . IndexOf ( "-------------------------------------------------------------------------------" ) == 0 )
1742
1778
{
@@ -2112,5 +2148,44 @@ private void ChkRunAutomaticallyMinimized_Checked(object sender, RoutedEventArgs
2112
2148
Properties . Settings . Default . runAutomaticallyMinimized = isChecked ;
2113
2149
Properties . Settings . Default . Save ( ) ;
2114
2150
}
2151
+
2152
+ private void MenuItemEditPackages_Click ( object sender , RoutedEventArgs e )
2153
+ {
2154
+ // TODO read Editor\Data\Resources\PackageManager\Editor\manifest.json
2155
+ // TODO read list of buildin packages *or no need, its com.unity.modules.*
2156
+ // TODO show list of packages (with buildin packages hidden from the list)
2157
+ // TODO user can enable/disable packages
2158
+ // TODO save back to the JSON file (NOTE cannot write if not admin! need to run some batch command elevated to overwrite file?)
2159
+ // TODO or, allow setting filter for packages (so can have custom "dont want"-packages list, and then remove those automatically! (from generated project, so original manifest can stay, but at which point..)
2160
+ }
2161
+
2162
+ private void MenuItemUpdatesReleaseNotes_Click ( object sender , RoutedEventArgs e )
2163
+ {
2164
+ var unity = GetSelectedUpdate ( ) ;
2165
+ Tools . OpenReleaseNotes ( unity ? . Version ) ;
2166
+ }
2167
+
2168
+ private void BtnClearBuildReportSearch_Click ( object sender , RoutedEventArgs e )
2169
+ {
2170
+ txtSearchBoxBuildReport . Text = "" ;
2171
+ }
2172
+
2173
+ private void TxtSearchBoxBuildReport_PreviewKeyDown ( object sender , KeyEventArgs e )
2174
+ {
2175
+ switch ( e . Key )
2176
+ {
2177
+ case Key . Up :
2178
+ case Key . Down :
2179
+ Tools . SetFocusToGrid ( gridBuildReport ) ;
2180
+ break ;
2181
+ default :
2182
+ break ;
2183
+ }
2184
+ }
2185
+
2186
+ private void TxtSearchBoxBuildReport_TextChanged ( object sender , TextChangedEventArgs e )
2187
+ {
2188
+ if ( gridBuildReport . ItemsSource != null ) FilterBuildReport ( ) ;
2189
+ }
2115
2190
} // class
2116
2191
} //namespace
0 commit comments