@@ -32,43 +32,30 @@ public interface IGameState {
3232 TEnum GetEnum < TEnum > ( VariablePath path ) where TEnum : Enum ;
3333
3434 FrozenDictionary < string , Func < IGameState , object ? > > PropertyMap { get ; }
35-
36- [ Obsolete ( "Used for reflection access to NewtonsoftGameState properties" ) ]
37- Lazy < ObjectAccessor > LazyObjectAccessor { get ; }
3835}
3936
4037public abstract class GameState : IGameState
4138{
42- private static LocalPcInformation ? _localPcInfo ;
43-
4439 [ PublicAPI ] // game profiles can still access this
45- public static LocalPcInformation LocalPCInfo => _localPcInfo ??= new LocalPcInformation ( ) ;
40+ public static LocalPcInformation LocalPCInfo => LocalPcInformation . Instance ;
4641
47- private static AudioNode ? _audio ;
4842 [ PublicAPI ]
49- public static AudioNode Audio => _audio ??= new AudioNode ( ) ;
43+ public static AudioNode Audio => AudioNode . Instance ;
5044
51- private static DevicesNode ? _devices ;
5245 [ PublicAPI ]
53- public static DevicesNode Devices => _devices ??= new DevicesNode ( ) ;
46+ public static DevicesNode Devices => DevicesNode . Instance ;
5447
55- private DesktopNode ? _desktop ;
5648 [ PublicAPI ]
57- public DesktopNode Desktop => _desktop ??= new DesktopNode ( ) ;
49+ public static DesktopNode Desktop => DesktopNode . Instance ;
5850
59- private static MediaNode ? _media ;
6051 [ PublicAPI ]
61- public static MediaNode Media => _media ??= new MediaNode ( ) ;
52+ public static MediaNode Media => MediaNode . Instance ;
6253
63- private CelestialData ? _celestialData ;
64- public CelestialData CelestialData => _celestialData ??= new CelestialData ( ) ;
65-
66- private static ProcessesNode ? _processes ;
6754 [ PublicAPI ]
68- public static ProcessesNode Processes => _processes ??= new ProcessesNode ( ) ;
55+ public static CelestialData CelestialData => CelestialData . Instance ;
6956
70- [ GameStateIgnore ]
71- public Lazy < ObjectAccessor > LazyObjectAccessor { get ; }
57+ [ PublicAPI ]
58+ public static ProcessesNode Processes => ProcessesNode . Instance ;
7259
7360 [ JsonIgnore ]
7461 [ GameStateIgnore ]
@@ -79,7 +66,6 @@ public abstract class GameState : IGameState
7966 /// </summary>
8067 protected GameState ( )
8168 {
82- LazyObjectAccessor = new Lazy < ObjectAccessor > ( ( ) => ObjectAccessor . Create ( this ) ) ;
8369 }
8470
8571 #region GameState path resolution
@@ -132,11 +118,16 @@ public partial class NewtonsoftGameState : GameState
132118 /// </summary>
133119 [ GameStateIgnore ]
134120 public bool Announce { get ; } = true ;
121+
122+ [ GameStateIgnore ]
123+ [ Obsolete ( "Used for reflection access to NewtonsoftGameState properties" ) ]
124+ public Lazy < ObjectAccessor > LazyObjectAccessor { get ; }
135125
136126 public NewtonsoftGameState ( )
137127 {
138128 Json = "{}" ;
139129 _parsedData = new ( ( ) => new JObject ( ) ) ;
130+ LazyObjectAccessor = new Lazy < ObjectAccessor > ( ( ) => ObjectAccessor . Create ( this ) ) ;
140131 }
141132
142133 public NewtonsoftGameState ( string json , bool announce ) : this ( json )
@@ -151,6 +142,7 @@ public NewtonsoftGameState(string json)
151142
152143 Json = json ;
153144 _parsedData = new ( ( ) => JObject . Parse ( json ) ) ;
145+ LazyObjectAccessor = new Lazy < ObjectAccessor > ( ( ) => ObjectAccessor . Create ( this ) ) ;
154146 }
155147
156148 /// <summary>
0 commit comments