|
|
|
@ -37,30 +37,17 @@ namespace IEC61850
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class ConfigFileParser
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
static extern IntPtr FileSystem_openFile(string filePath, [MarshalAs(UnmanagedType.I1)] bool readWrite);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
static extern IntPtr ConfigFileParser_createModelFromConfigFile(IntPtr fileHandle);
|
|
|
|
|
static extern IntPtr ConfigFileParser_createModelFromConfigFileEx(string filename);
|
|
|
|
|
|
|
|
|
|
public static IedModel CreateModelFromConfigFile(string filePath)
|
|
|
|
|
{
|
|
|
|
|
IntPtr fileHandle = FileSystem_openFile (filePath, false);
|
|
|
|
|
|
|
|
|
|
if (fileHandle != IntPtr.Zero) {
|
|
|
|
|
|
|
|
|
|
IntPtr retVal = ConfigFileParser_createModelFromConfigFile (fileHandle);
|
|
|
|
|
IntPtr retVal = ConfigFileParser_createModelFromConfigFileEx (filePath);
|
|
|
|
|
if (retVal == IntPtr.Zero) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new IedModel (retVal);
|
|
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
return null;
|
|
|
|
|
//TODO else throw exception
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|