KspData LoadKspFile T  Method (String, KspProcessor T ) KerbalData - KSP Data Unlocked!
Loads and de-serializes a KSP data files into the requested type

Namespace: KerbalData
Assembly: KerbalData (in KerbalData.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax

public static T LoadKspFile<T>(
	string path,
	KspProcessor<T> processor
)
where T : class, new()

Parameters

path
Type: OnlineSystem String
full path of file location
processor
Type: KerbalData.Serialization KspProcessor T 
processor instance to use for de-serialization
Type Parameters

T
model type to de-serialize to

Return Value

de-serialized object instance
Examples

To load a file a path and a KspProcessor T  instance are required. A KspProcessor T  instance can be acquired from the ProcessorRegistry class.

// Creating a registry using the config named "kerbalData" see the documentation on the ProcessorRegistry for more details on the Create(string) and Create(ApiConfig) methods. 
var registry = ProcessorRegistry.Create("kerbalData");

// When the file is loaded the Create method is called on the registry instance and the desired serialization type is provided to the registry to acquire the right instance.  
var data = KspData.LoadKspFile<SaveFile>(@"C:\my\file\location\filename.sfs", registry.Create<SaveFile>());
See Also