Opc.Ua.Configuration.PseudoComServer.LoadConfiguredEndpointFromFile C# (CSharp) Method

LoadConfiguredEndpointFromFile() private static method

Reads the UA endpoint information associated the CLSID
private static LoadConfiguredEndpointFromFile ( System.Guid clsid ) : ConfiguredEndpoint
clsid System.Guid The CLSID used to activate the COM server.
return ConfiguredEndpoint
        private static ConfiguredEndpoint LoadConfiguredEndpointFromFile(Guid clsid)
        {
            try
            {
                string relativePath = Utils.Format("{0}\\{1}.xml", ComPseudoServersDirectory, clsid);
                string absolutePath = Utils.GetAbsoluteFilePath(relativePath, false, false, false);

                // oops - nothing found.
                if (absolutePath == null)
                {
                    return null;
                }

                // open the file.
                FileStream istrm = File.Open(absolutePath, FileMode.Open, FileAccess.Read);

                using (XmlTextReader reader = new XmlTextReader(istrm))
                {
                    DataContractSerializer serializer = new DataContractSerializer(typeof(ConfiguredEndpoint));
                    return (ConfiguredEndpoint)serializer.ReadObject(reader, false);
                }
            }
            catch (Exception e)
            {
                Utils.Trace(e, "Unexpected error loading endpoint configuration for COM Proxy with CLSID={0}.", clsid);
                return null;
            }
        }