openHistorian.Adapters.Connection.Connection C# (CSharp) Метод

Connection() публичный Метод

Creates a new openHistorian Connection.
public Connection ( string historianServer, string instanceName ) : System
historianServer string Historian server connection string, e.g., "localhost" or "myhistorian:38402"
instanceName string Instance name of historian, e.g., "PPA".
Результат System
        public Connection(string historianServer, string instanceName)
        {
            if (string.IsNullOrEmpty(historianServer))
                throw new ArgumentNullException(nameof(historianServer), "Missing historian server parameter");

            if (string.IsNullOrEmpty(instanceName))
                throw new ArgumentNullException(nameof(instanceName), "Missing historian instance name parameter");

            string[] parts = historianServer.Split(':');
            string hostName = parts[0];
            int port;

            if (parts.Length < 2 || !int.TryParse(parts[1], out port))
                port = DefaultHistorianPort;

            m_client = new HistorianClient(hostName, port);
            m_instanceName = instanceName;
        }