Smrf.NodeXL.ExcelTemplate.OpenWorkbookSettingsFileDialog.OpenObject C# (CSharp) Method

OpenObject() protected method

protected OpenObject ( String sFileName, Object &oObject ) : void
sFileName String
oObject Object
return void
    OpenObject
    (
        String sFileName,
        out Object oObject
    )
    {
        Debug.Assert( !String.IsNullOrEmpty(sFileName) );
        Debug.Assert( File.Exists(sFileName) );
        AssertValid();

        oObject = null;
        String sWorkbookSettings = FileUtil.ReadTextFile(sFileName);

        // Test for valid XML.

        XmlDocument oXmlDocument = new XmlDocument();

        try
        {
            oXmlDocument.LoadXml(sWorkbookSettings);
        }
        catch (XmlException)
        {
            throw new XmlException(
                "This does not appear to be a NodeXL options file."
                );
        }

        oObject = sWorkbookSettings;
    }