Loads and de-serializes a KSP data file into the requested type
Namespace: KerbalDataAssembly: KerbalData (in KerbalData.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
Parameters
- path
- Type:
System String
full path of file location
- configSectionName (Optional)
- Type:
System String
configuration section name to use for processor lookup
Type Parameters
- T
- model type to de-serialize to
Return Value
de-serialized object instanceExamples
A null configuration causes the class to load embedded defaults. This is good for most common uses and is the recommended way for loading individual files. A type parameter must be supplied to the method so the correct type can be serialized. KerbalData is not yet able to determine the type from the data loaded. The developer must provide this information.
var data = KspData.LoadKspFile<SaveFile>(@"C:\my\file\location\filename.ext");
If a configuration section name is provided, KspData will load the named .NET configuration and use it's data in creating the ProcessorRegistry used in serialization. The following example is the same configuration that is used by default.
var data = KspData.LoadKspFile<SaveFile>@"C:\my\file\location\filename.ext", "kerbalData");
See Also