/// <summary>
        /// Exports a server to a export file.
        /// </summary>
        private static Export.RegisteredServer Export(RegisteredDotNetOpcServer server)
        {
            Export.RegisteredServer serverToExport = new Export.RegisteredServer();

            serverToExport.Clsid  = server.Clsid.ToString();
            serverToExport.ProgId = server.ProgId;

            if (server.Description != server.ProgId)
            {
                serverToExport.Description = server.Description;
            }

            serverToExport.WrapperClsid = ConfigUtils.ProgIDFromCLSID(server.WrapperClsid);
            serverToExport.ServerClsid  = ConfigUtils.ProgIDFromCLSID(server.ServerClsid);

            // export parameters.
            serverToExport.Parameter = new Export.Parameter[server.Parameters.Count];

            int index = 0;

            foreach (KeyValuePair <string, string> entry in server.Parameters)
            {
                Export.Parameter parameter = new Export.Parameter();

                parameter.Name  = entry.Key;
                parameter.Value = entry.Value;

                serverToExport.Parameter[index++] = parameter;
            }

            // return exported server.
            return(serverToExport);
        }
        /// <summary>
        /// Imports a server from a export file.
        /// </summary>
        private static RegisteredDotNetOpcServer Import(Export.RegisteredServer serverToImport)
        {
            RegisteredDotNetOpcServer server = new RegisteredDotNetOpcServer();

            // assign clsid if none specified.
            if (String.IsNullOrEmpty(serverToImport.Clsid))
            {
                server.Clsid = ConfigUtils.CLSIDFromProgID(serverToImport.ProgId);

                if (server.Clsid == Guid.Empty)
                {
                    server.Clsid = Guid.NewGuid();
                }
            }
            else
            {
                server.Clsid = new Guid(serverToImport.Clsid);
            }

            // get prog id and description.
            server.ProgId      = serverToImport.ProgId;
            server.Description = serverToImport.Description;

            // parse wrapper clsid/prog id.
            try
            {
                server.WrapperClsid = new Guid(serverToImport.WrapperClsid);
            }
            catch
            {
                server.WrapperClsid = ConfigUtils.CLSIDFromProgID(serverToImport.WrapperClsid);
            }

            // parse wrapped server clsid/prog id.
            try
            {
                server.ServerClsid = new Guid(serverToImport.ServerClsid);
            }
            catch
            {
                server.ServerClsid = ConfigUtils.CLSIDFromProgID(serverToImport.ServerClsid);
            }

            // read parameters.
            server.Parameters.Clear();

            if (!ConfigUtils.IsEmpty(serverToImport.Parameter))
            {
                for (int ii = 0; ii < serverToImport.Parameter.Length; ii++)
                {
                    Export.Parameter parameter = serverToImport.Parameter[ii];

                    if (parameter != null && !String.IsNullOrEmpty(parameter.Name))
                    {
                        server.Parameters.Add(parameter.Name, parameter.Value);
                    }
                }
            }

            // return new server.
            return(server);
        }
        /// <summary>
        /// Exports a server to a export file.
        /// </summary>
        private static Export.RegisteredServer Export(RegisteredDotNetOpcServer server)
        {
            Export.RegisteredServer serverToExport = new Export.RegisteredServer();

            serverToExport.Clsid  = server.Clsid.ToString();
            serverToExport.ProgId = server.ProgId;

            if (server.Description != server.ProgId)
            {
                serverToExport.Description = server.Description;
            }

            serverToExport.WrapperClsid = ConfigUtils.ProgIDFromCLSID(server.WrapperClsid);
            serverToExport.ServerClsid  = ConfigUtils.ProgIDFromCLSID(server.ServerClsid);

            // export parameters.
            serverToExport.Parameter = new Export.Parameter[server.Parameters.Count];

            int index = 0;

            foreach (KeyValuePair<string,string> entry in server.Parameters)
            {
                Export.Parameter parameter = new Export.Parameter();

                parameter.Name  = entry.Key;
                parameter.Value = entry.Value;

                serverToExport.Parameter[index++] = parameter;
            }

            // return exported server.
            return serverToExport;
        }