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

            return(new GetDicomServerConfigurationResult {
                Configuration = settings.GetBasicConfiguration()
            });
        }
        public DicomServerExtendedConfiguration UpdateExtendedConfiguration(DicomServerExtendedConfiguration newConfiguration)
        {
            var settings = new DicomServerSettings();
            var proxy    = settings.GetProxy();

            proxy.AllowUnknownCaller   = newConfiguration.AllowUnknownCaller;
            proxy.QueryResponsesInUtf8 = newConfiguration.QueryResponsesInUtf8;
            // TODO (CR Jun 2012): For now, the storage SOP Classes and Transfer Syntaxes are ignored.

            return(settings.GetExtendedConfiguration());
        }
        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());
        }
 public Proxy(DicomServerSettings settings)
 {
     _settings = settings;
 }