public GetDicomServerConfigurationResult GetConfiguration(GetDicomServerConfigurationRequest request)
        {
            var settings = new DicomServerSettings();

            return(new GetDicomServerConfigurationResult {
                Configuration = settings.GetBasicConfiguration()
            });
        }
コード例 #2
0
        public DicomServerConfiguration UpdateBasicConfiguration(DicomServerConfiguration newConfiguration)
        {
            Platform.CheckForNullReference(newConfiguration, "newConfiguration");
            Platform.CheckForEmptyString(newConfiguration.AETitle, "AETitle");
            Platform.CheckArgumentRange(newConfiguration.Port, 1, 65535, "Port");

            //Trim the strings before saving.
            newConfiguration.AETitle = newConfiguration.AETitle.Trim();
            if (!String.IsNullOrEmpty(newConfiguration.HostName))
            {
                newConfiguration.HostName = newConfiguration.HostName.Trim();
            }
            else
            {
                newConfiguration.HostName = "localhost"; //reset to default.
            }
            var settings = new DicomServerSettings();
            var proxy    = settings.GetProxy();

            proxy.AETitle  = newConfiguration.AETitle;
            proxy.HostName = newConfiguration.HostName;
            proxy.Port     = newConfiguration.Port;
            proxy.Save();

            // TODO (Marmot): While it doesn't do any harm to do this here, the listener should also poll periodically for configuration changes, just in case.
            try
            {
                DicomServer.RestartListener();
            }
            catch (EndpointNotFoundException)
            {
            }
            catch (Exception e)
            {
                Platform.Log(LogLevel.Warn, e, "Failed to restart the DICOM Server listener.");
                throw;
            }

            return(settings.GetBasicConfiguration());
        }