File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
2- using System . Collections . Generic ;
3- using System . ComponentModel ;
42using System . Drawing ;
53using System . Linq ;
6- using System . Text ;
74
85namespace Spectrogram
96{
@@ -34,18 +31,10 @@ public override string ToString()
3431 return $ "Colormap { Name } ";
3532 }
3633
37- public static Colormap [ ] GetColormaps ( )
38- {
39- IColormap [ ] ics = AppDomain . CurrentDomain . GetAssemblies ( )
40- . SelectMany ( s => s . GetTypes ( ) )
41- . Where ( p => p . IsInterface == false )
42- . Where ( p => p . ToString ( ) . StartsWith ( "Spectrogram.Colormaps." ) )
43- . Select ( x => x . ToString ( ) )
44- . Select ( path => ( IColormap ) Activator . CreateInstance ( Type . GetType ( path ) ) )
45- . ToArray ( ) ;
46-
47- return ics . Select ( x => new Colormap ( x ) ) . ToArray ( ) ;
48- }
34+ public static Colormap [ ] GetColormaps ( ) =>
35+ typeof ( Colormap ) . GetProperties ( )
36+ . Select ( x => ( Colormap ) x . GetValue ( x . Name ) )
37+ . ToArray ( ) ;
4938
5039 public static string [ ] GetColormapNames ( )
5140 {
You can’t perform that action at this time.
0 commit comments