Exemple #1
0
        /// <summary>
        /// Apply the Dicom Configuration to the Client,
        /// </summary>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="config">Dicom Configuration.</param>
        public override void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config)
        {
            // set up the worklist SCP
            WorklistScp worklistScp = new WorklistScp();

            // update supported transfer syntaxes here
            //worklistScp.ClearTransferSyntaxes();
            //worklistScp.AddTransferSyntax(HliScp.IMPLICIT_VR_LITTLE_ENDIAN);

            // Save the SCP and apply the configuration
            Scp = worklistScp;
            base.ApplyConfig(commonConfig, config);

            // set up the Modality Worklist information models
            _modalityWorklistInformationModel = new ModalityWorklistInformationModel();

            // load the information models
            _modalityWorklistInformationModel.LoadInformationModel(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, config.SourceDataDirectory));

            // add any default attribute values to the information models
            bool overWriteExistingValue = true;

            _modalityWorklistInformationModel.AddDefaultAttributeToInformationModel(overWriteExistingValue, "0x00400001", VR.AE, config.FromActorAeTitle);
            _modalityWorklistInformationModel.AddDefaultAttributeToInformationModel(overWriteExistingValue, "0x00400002", VR.DA, System.DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture));
            _modalityWorklistInformationModel.AddDefaultAttributeToInformationModel(overWriteExistingValue, "0x00400003", VR.TM, System.DateTime.Now.ToString("HHmmss", System.Globalization.CultureInfo.InvariantCulture));

            // add any additional attribute values to the information models
            //modalityWorklistInformationModel.AddAdditionalAttributeToInformationModel(overWriteExistingValue, "0x00080054", VR.AE, config.DvtAeTitle);

            // add the default message handlers with the information model
            worklistScp.AddDefaultMessageHandlers(_modalityWorklistInformationModel);
        }
Exemple #2
0
        /// <summary>
        /// Apply the Dicom Configuration to the Client,
        /// </summary>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="config">Dicom Configuration.</param>
        public override void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config)
        {
            // set up the worklist SCP
            WorklistScp worklistScp = new WorklistScp();

            // update supported transfer syntaxes here
            //worklistScp.ClearTransferSyntaxes();
            //worklistScp.AddTransferSyntax(HliScp.IMPLICIT_VR_LITTLE_ENDIAN);

            // Save the SCP and apply the configuration
            Scp = worklistScp;
            base.ApplyConfig(commonConfig, config);

            // set up the Modality Worklist information models
            _modalityWorklistInformationModel = new ModalityWorklistInformationModel();

            // load the information models
            _modalityWorklistInformationModel.LoadInformationModel(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, config.SourceDataDirectory));

            // add any default attribute values to the information models
            bool overWriteExistingValue = true;
            _modalityWorklistInformationModel.AddDefaultAttributeToInformationModel(overWriteExistingValue, "0x00400001", VR.AE, config.FromActorAeTitle);
            _modalityWorklistInformationModel.AddDefaultAttributeToInformationModel(overWriteExistingValue, "0x00400002", VR.DA, System.DateTime.Now.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture));
            _modalityWorklistInformationModel.AddDefaultAttributeToInformationModel(overWriteExistingValue, "0x00400003", VR.TM, System.DateTime.Now.ToString("HHmmss", System.Globalization.CultureInfo.InvariantCulture));

            // add any additional attribute values to the information models
            //modalityWorklistInformationModel.AddAdditionalAttributeToInformationModel(overWriteExistingValue, "0x00080054", VR.AE, config.DvtAeTitle);

            // add the default message handlers with the information model
            worklistScp.AddDefaultMessageHandlers(_modalityWorklistInformationModel);
        }
        /// <summary>
        /// Apply the Dicom Configuration to the Client,
        /// </summary>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="config">Dicom Configuration.</param>
        public override void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config)
        {
            // set up the Query/Retrieve information models
            QueryRetrieveInformationModels informationModels = new QueryRetrieveInformationModels();

            // Do not load the Information Models here as they are loaded (refreshed) on each query
            // - just define the data directory
            informationModels.DataDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, config.SourceDataDirectory);

            // add any default attribute values to the information models
            bool overWriteExistingValue = true;
            informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080005", VR.CS, "ISO IR 6");
            informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080090", VR.PN, "Referring^Physician^Dr");

            // add any additional attribute values to the information models
            informationModels.AddAdditionalAttribute(overWriteExistingValue, "0x00080054", VR.AE, config.ToActorAeTitle);

            // set up the query/retrieve SCP
            QueryRetrieveScp queryRetrieveScp = new QueryRetrieveScp();

            // update supported transfer syntaxes here
            //queryRetrieveScp.ClearTransferSyntaxes();
            //queryRetrieveScp.AddTransferSyntax(HliScp.IMPLICIT_VR_LITTLE_ENDIAN);

            // Save the SCP and apply the configuration
            Scp = queryRetrieveScp;
            base.ApplyConfig(commonConfig, config);

            // add the default message handlers with the information models
            queryRetrieveScp.AddDefaultMessageHandlers(informationModels);
        }
Exemple #4
0
        /// <summary>
        /// Apply the Dicom Configuration to the Client,
        /// </summary>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="config">Dicom Configuration.</param>
        public override void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config)
        {
            // set up the Query/Retrieve information models
            QueryRetrieveInformationModels informationModels = new QueryRetrieveInformationModels();

            // Do not load the Information Models here as they are loaded (refreshed) on each query
            // - just define the data directory
            informationModels.DataDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, config.SourceDataDirectory);

            // add any default attribute values to the information models
            bool overWriteExistingValue = true;

            informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080005", VR.CS, "ISO IR 6");
            informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080090", VR.PN, "Referring^Physician^Dr");

            // add any additional attribute values to the information models
            informationModels.AddAdditionalAttribute(overWriteExistingValue, "0x00080054", VR.AE, config.ToActorAeTitle);

            // set up the query/retrieve SCP
            QueryRetrieveScp queryRetrieveScp = new QueryRetrieveScp();

            // update supported transfer syntaxes here
            //queryRetrieveScp.ClearTransferSyntaxes();
            //queryRetrieveScp.AddTransferSyntax(HliScp.IMPLICIT_VR_LITTLE_ENDIAN);

            // Save the SCP and apply the configuration
            Scp = queryRetrieveScp;
            base.ApplyConfig(commonConfig, config);

            // add the default message handlers with the information models
            queryRetrieveScp.AddDefaultMessageHandlers(informationModels);
        }
Exemple #5
0
        /// <summary>
        /// Update the Dicom Configuration of the Server.
        /// </summary>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="clientConfig">Dicom Client Configuration.</param>
        public void UpdateConfig(CommonConfig commonConfig, DicomPeerToPeerConfig clientConfig)
        {
            _scp.Options.RemotePort     = clientConfig.PortNumber;
            _scp.Options.RemoteHostName = clientConfig.ToActorIpAddress;

            foreach (System.String filename in clientConfig.DefinitionFiles)
            {
                _scp.Options.LoadDefinitionFile(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, filename));
            }
        }
Exemple #6
0
        /// <summary>
        /// Apply the Dicom Configuration to the Client,
        /// </summary>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="config">Dicom Configuration.</param>
        public override void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config)
        {
            // Instantiate a new MPPS SCP and add the default message handlers
            MppsScp mppsScp = new MppsScp();
            mppsScp.AddDefaultMessageHandlers();

            // update supported transfer syntaxes here
            //mppsScp.ClearTransferSyntaxes();
            //mppsScp.AddTransferSyntax(HliScp.IMPLICIT_VR_LITTLE_ENDIAN);

            // Save the SCP and apply the configuration
            Scp = mppsScp;
            base.ApplyConfig(commonConfig, config);
        }
Exemple #7
0
        /// <summary>
        /// Apply the Dicom Configuration to the Client,
        /// </summary>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="config">Dicom Configuration.</param>
        public override void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config)
        {
            // Instantiate a new Print SCP and add the default message handlers
            PrintScp printScp = new PrintScp();

            printScp.AddDefaultMessageHandlers();

            // update supported transfer syntaxes here
            //printScp.ClearTransferSyntaxes();
            //printScp.AddTransferSyntax(HliScp.IMPLICIT_VR_LITTLE_ENDIAN);

            // Save the SCP and apply the configuration
            Scp = printScp;
            base.ApplyConfig(commonConfig, config);
        }
Exemple #8
0
        /// <summary>
        /// Apply the Dicom Configuration to the Client,
        /// </summary>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="config">Dicom Configuration.</param>
        public override void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config)
        {
            // set up the storage SCP
            StorageScp storageScp = new StorageScp();

            // update supported transfer syntaxes here
            //storageScp.ClearTransferSyntaxes();
            //storageScp.AddTransferSyntax(HliScp.IMPLICIT_VR_LITTLE_ENDIAN);

            // Save the SCP and apply the configuration
            Scp = storageScp;
            base.ApplyConfig(commonConfig, config);

            // add the default message handlers
            storageScp.AddDefaultMessageHandlers();
        }
Exemple #9
0
        /// <summary>
        /// Apply the Dicom Configuration to the Client,
        /// </summary>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="config">Dicom Configuration.</param>
        public override void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config)
        {
            // set up the storage SCP
            StorageScp storageScp = new StorageScp();

            // update supported transfer syntaxes here
            //storageScp.ClearTransferSyntaxes();
            //storageScp.AddTransferSyntax(HliScp.IMPLICIT_VR_LITTLE_ENDIAN);

            // Save the SCP and apply the configuration
            Scp = storageScp;
            base.ApplyConfig(commonConfig, config);

            // add the default message handlers
            storageScp.AddDefaultMessageHandlers();
        }
        /// <summary>
        /// Apply the Dicom Configuration to the Client,
        /// </summary>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="config">Dicom Configuration.</param>
        public override void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config)
        {
            // Do not load the Information Models here as hey are loaded (refreshed) on each storage commitment event
            // - just define the data directory
            _informationModels.DataDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, config.SourceDataDirectory);

            // add any default attribute values to the information models
            bool overWriteExistingValue = true;

            _informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080005", VR.CS, "ISO IR 6");
            _informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080090", VR.PN, "Referring^Physician^Dr");

            // set up the storage commit SCP
            StorageCommitScp storageCommitScp = new StorageCommitScp();

            // update supported transfer syntaxes here
            //storageCommitScp.ClearTransferSyntaxes();
            //storageCommitScp.AddTransferSyntax(HliScp.IMPLICIT_VR_LITTLE_ENDIAN);

            // Save the SCP and apply the configuration
            Scp = storageCommitScp;
            base.ApplyConfig(commonConfig, config);

            // use the common config option 1 to determine how the storage commitment should be handled
            if (ConfigOption1.Equals("DO_STORAGE_COMMITMENT_ON_SINGLE_ASSOCIATION") == true)
            {
                // add the default message handlers with the information model
                // - allows support for the NActionNEventReportHandler which
                // returns an N-EVENT-REPORT-RQ on the same association as the
                // N-ACTION-RQ was received.
                storageCommitScp.AddDefaultMessageHandlers(_informationModels, 5000);
            }
            else
            {
                // add the default message handlers
                storageCommitScp.AddDefaultMessageHandlers();
            }
        }
        /// <summary>
        /// Apply the Dicom Configuration to the Client,
        /// </summary>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="config">Dicom Configuration.</param>
        public override void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config)
        {
            // Do not load the Information Models here as hey are loaded (refreshed) on each storage commitment event
            // - just define the data directory
            _informationModels.DataDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, config.SourceDataDirectory);

            // add any default attribute values to the information models
            bool overWriteExistingValue = true;
            _informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080005", VR.CS, "ISO IR 6");
            _informationModels.AddDefaultAttribute(overWriteExistingValue, "0x00080090", VR.PN, "Referring^Physician^Dr");

            // set up the storage commit SCP
            StorageCommitScp storageCommitScp = new StorageCommitScp();

            // update supported transfer syntaxes here
            //storageCommitScp.ClearTransferSyntaxes();
            //storageCommitScp.AddTransferSyntax(HliScp.IMPLICIT_VR_LITTLE_ENDIAN);

            // Save the SCP and apply the configuration
            Scp = storageCommitScp;
            base.ApplyConfig(commonConfig, config);

            // use the common config option 1 to determine how the storage commitment should be handled
            if (ConfigOption1.Equals("DO_STORAGE_COMMITMENT_ON_SINGLE_ASSOCIATION") == true)
            {
                // add the default message handlers with the information model
                // - allows support for the NActionNEventReportHandler which
                // returns an N-EVENT-REPORT-RQ on the same association as the
                // N-ACTION-RQ was received.
                storageCommitScp.AddDefaultMessageHandlers(_informationModels, 5000);
            }
            else
            {
                // add the default message handlers
                storageCommitScp.AddDefaultMessageHandlers();
            }
        }
Exemple #12
0
        /// <summary>
        /// Apply the Dicom Configuration to the Server.
        /// </summary>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="config">Dicom Configuration.</param>
        public virtual void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config)
        {
            if (_scp != null)
            {
                _scp.Initialize(ParentActor.ThreadManager);
                _scp.Options.SessionId  = config.SessionId;
                _scp.Options.Identifier = String.Format("To_{0}_From_{1}",
                                                        ParentActor.ActorName.TypeId,
                                                        ActorName.TypeId);

                if (commonConfig.ResultsDirectory != System.String.Empty)
                {
                    _scp.Options.StartAndStopResultsGatheringEnabled = true;
                    _scp.ResultsFilePerAssociation = true;

                    if (commonConfig.ResultsSubdirectory != System.String.Empty)
                    {
                        _scp.Options.ResultsDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.ResultsDirectory + "\\" + commonConfig.ResultsSubdirectory);
                    }
                    else
                    {
                        _scp.Options.ResultsDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.ResultsDirectory);
                    }
                }
                else
                {
                    _scp.Options.StartAndStopResultsGatheringEnabled = false;
                }

                _scp.Options.CredentialsFilename = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.CredentialsFilename);
                _scp.Options.CertificateFilename = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.CertificateFilename);
                _scp.Options.SecureConnection    = config.SecureConnection;

                _scp.Options.LocalAeTitle = config.ToActorAeTitle;
                _scp.Options.LocalPort    = config.PortNumber;

                _scp.Options.RemoteAeTitle  = config.FromActorAeTitle;
                _scp.Options.RemotePort     = config.PortNumber;
                _scp.Options.RemoteHostName = config.ToActorIpAddress;

                _scp.Options.AutoValidate = config.AutoValidate;

                _scp.Options.DataDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, config.StoreDataDirectory);
                if (config.StoreData == true)
                {
                    _scp.Options.StorageMode = Dvtk.Sessions.StorageMode.AsMediaOnly;
                }
                else
                {
                    _scp.Options.StorageMode = Dvtk.Sessions.StorageMode.NoStorage;
                }

                foreach (System.String filename in config.DefinitionFiles)
                {
                    _scp.Options.LoadDefinitionFile(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, filename));
                }

                // finally copy any config options
                _configOption1 = config.ActorOption1;
                _configOption2 = config.ActorOption2;
                _configOption3 = config.ActorOption3;
            }
        }
Exemple #13
0
        /// <summary>
        /// Update the Dicom Configuration of the Server.
        /// </summary>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="clientConfig">Dicom Client Configuration.</param>
        public void UpdateConfig(CommonConfig commonConfig, DicomPeerToPeerConfig clientConfig)
        {
            _scp.Options.RemotePort = clientConfig.PortNumber;
            _scp.Options.RemoteHostName = clientConfig.ToActorIpAddress;

            foreach (System.String filename in clientConfig.DefinitionFiles)
            {
                _scp.Options.LoadDefinitionFile(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, filename));
            }
        }
Exemple #14
0
        /// <summary>
        /// Apply the Dicom Configuration to the Server.
        /// </summary>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="config">Dicom Configuration.</param>
        public virtual void ApplyConfig(CommonConfig commonConfig, DicomPeerToPeerConfig config)
        {
            if (_scp != null)
            {
                _scp.Initialize(ParentActor.ThreadManager);
                _scp.Options.SessionId = config.SessionId;
                _scp.Options.Identifier = String.Format("To_{0}_From_{1}",
                    ParentActor.ActorName.TypeId,
                    ActorName.TypeId);

                if (commonConfig.ResultsDirectory != System.String.Empty)
                {
                    _scp.Options.StartAndStopResultsGatheringEnabled = true;
                    _scp.ResultsFilePerAssociation = true;

                    if (commonConfig.ResultsSubdirectory != System.String.Empty)
                    {
                        _scp.Options.ResultsDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.ResultsDirectory + "\\" + commonConfig.ResultsSubdirectory);
                    }
                    else
                    {
                        _scp.Options.ResultsDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.ResultsDirectory);
                    }
                }
                else
                {
                    _scp.Options.StartAndStopResultsGatheringEnabled = false;
                }

                _scp.Options.CredentialsFilename = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.CredentialsFilename);
                _scp.Options.CertificateFilename = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.CertificateFilename);
                _scp.Options.SecureConnection = config.SecureConnection;

                _scp.Options.LocalAeTitle = config.ToActorAeTitle;
                _scp.Options.LocalPort = config.PortNumber;

                _scp.Options.RemoteAeTitle = config.FromActorAeTitle;
                _scp.Options.RemotePort = config.PortNumber;
                _scp.Options.RemoteHostName = config.ToActorIpAddress;

                _scp.Options.AutoValidate = config.AutoValidate;

                _scp.Options.DataDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, config.StoreDataDirectory);
                if (config.StoreData == true)
                {
                    _scp.Options.StorageMode = Dvtk.Sessions.StorageMode.AsMediaOnly;
                }
                else
                {
                    _scp.Options.StorageMode = Dvtk.Sessions.StorageMode.NoStorage;
                }

                foreach (System.String filename in config.DefinitionFiles)
                {
                    _scp.Options.LoadDefinitionFile(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, filename));
                }

                // finally copy any config options
                _configOption1 = config.ActorOption1;
                _configOption2 = config.ActorOption2;
                _configOption3 = config.ActorOption3;
            }
        }
Exemple #15
0
        /// <summary>
        /// Load the Actor Configuration into the Integration Profile.
        /// </summary>
        /// <param name="configurationFilename">Configuration Filename</param>
        public void Load(System.String configurationFilename)
        {
            _actorConfigCollection = new ActorConfigCollection();
            _peerToPeerConfigCollection = new BasePeerToPeerConfigCollection();

            try
            {
                XmlTextReader reader = new XmlTextReader(configurationFilename);
                while (reader.EOF == false)
                {
                    reader.ReadStartElement("IheIntegrationProfile");
                    _profileName = reader.ReadElementString("IntegrationProfileName");
                    _commonConfig.RootedBaseDirectory = reader.ReadElementString("RootedBaseDirectory");
                    _commonConfig.ResultsDirectory = reader.ReadElementString("ResultsDirectory");

                    // read OverwriteResults - added later - some config files may not contain this parameter
                    reader.ReadString();
                    if (reader.Name == "OverwriteResults")
                    {
                        System.String overwriteResults = reader.ReadElementString("OverwriteResults");
                        if (overwriteResults == "True")
                        {
                            _commonConfig.OverwriteResults = true;
                        }
                        else
                        {
                            _commonConfig.OverwriteResults = false;
                        }
                    }

                    _commonConfig.CredentialsFilename = reader.ReadElementString("CredentialsFilename");
                    _commonConfig.CertificateFilename = reader.ReadElementString("CertificateFilename");
                    _commonConfig.NistWebServiceUrl = reader.ReadElementString("NistWebServiceUrl");
                    _commonConfig.Hl7ProfileDirectory = reader.ReadElementString("Hl7ProfileDirectory");
                    _commonConfig.Hl7ProfileStoreName = reader.ReadElementString("Hl7ProfileStoreName");
                    _commonConfig.Hl7ValidationContextFilename = reader.ReadElementString("Hl7ValidationContextFilename");
                    System.String interactive = reader.ReadElementString("Interactive");
                    if (interactive == "True")
                    {
                        _commonConfig.Interactive = true;
                    }
                    else
                    {
                        _commonConfig.Interactive = false;
                    }

                    while ((reader.IsStartElement()) &&
                        (reader.Name == "ActorConfiguration"))
                    {
                        reader.ReadStartElement("ActorConfiguration");
                        reader.ReadStartElement("ActorName");
                        ActorTypeEnum actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType"));
                        System.String id = reader.ReadElementString("ActorId");
                        ActorName actorName = new ActorName(actorType, id);
                        reader.ReadEndElement();
                        ActorConfigStateEnum configState = ActorConfigState.ConfigStateEnum(reader.ReadElementString("ConfigState"));
                        ActorConfig actorConfig = new ActorConfig(actorName, configState);
                        _actorConfigCollection.Add(actorConfig);
                        reader.ReadEndElement();
                    }

                    while ((reader.IsStartElement()) &&
                        ((reader.Name == "DicomPeerToPeerConfiguration") ||
                        (reader.Name == "Hl7PeerToPeerConfiguration")))
                    {
                        if (reader.Name == "DicomPeerToPeerConfiguration")
                        {
                            DicomPeerToPeerConfig dicomPeerToPeerConfig = new DicomPeerToPeerConfig();

                            reader.ReadStartElement("DicomPeerToPeerConfiguration");
                            reader.ReadStartElement("FromActor");
                            reader.ReadStartElement("ActorName");
                            ActorTypeEnum actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType"));
                            System.String id = reader.ReadElementString("ActorId");
                            ActorName actorName = new ActorName(actorType, id);
                            dicomPeerToPeerConfig.FromActorName = actorName;
                            reader.ReadEndElement();
                            dicomPeerToPeerConfig.FromActorAeTitle = reader.ReadElementString("AeTitle");
                            reader.ReadEndElement();
                            reader.ReadStartElement("ToActor");
                            reader.ReadStartElement("ActorName");
                            actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType"));
                            id = reader.ReadElementString("ActorId");
                            actorName = new ActorName(actorType, id);
                            dicomPeerToPeerConfig.ToActorName = actorName;
                            reader.ReadEndElement();
                            dicomPeerToPeerConfig.ToActorAeTitle = reader.ReadElementString("AeTitle");
                            dicomPeerToPeerConfig.ToActorIpAddress = reader.ReadElementString("IpAddress");
                            reader.ReadEndElement();
                            dicomPeerToPeerConfig.PortNumber = UInt16.Parse(reader.ReadElementString("PortNumber"));
                            System.String secureConnection = reader.ReadElementString("SecureConnection");
                            if (secureConnection == "True")
                            {
                                dicomPeerToPeerConfig.SecureConnection = true;
                            }
                            else
                            {
                                dicomPeerToPeerConfig.SecureConnection = false;
                            }

                            // read AutoValidate - added later - some config files may not contain this parameter
                            reader.ReadString();
                            if (reader.Name == "AutoValidate")
                            {
                                System.String autoValidate = reader.ReadElementString("AutoValidate");
                                if (autoValidate == "True")
                                {
                                    dicomPeerToPeerConfig.AutoValidate = true;
                                }
                                else
                                {
                                    dicomPeerToPeerConfig.AutoValidate = false;
                                }
                            }

                            dicomPeerToPeerConfig.ActorOption1 = reader.ReadElementString("ActorOption1");
                            dicomPeerToPeerConfig.ActorOption2 = reader.ReadElementString("ActorOption2");
                            dicomPeerToPeerConfig.ActorOption3 = reader.ReadElementString("ActorOption3");
                            dicomPeerToPeerConfig.SessionId = UInt16.Parse(reader.ReadElementString("SessionId"));
                            dicomPeerToPeerConfig.SourceDataDirectory = reader.ReadElementString("SourceDataDirectory");
                            dicomPeerToPeerConfig.StoreDataDirectory = reader.ReadElementString("StoreDataDirectory");
                            System.String storeData = reader.ReadElementString("StoreData");
                            if (storeData == "True")
                            {
                                dicomPeerToPeerConfig.StoreData = true;
                            }
                            else
                            {
                                dicomPeerToPeerConfig.StoreData = false;
                            }

                            reader.ReadStartElement("DefinitionFiles");

                            bool readingDefinitionFiles = true;
                            while (readingDefinitionFiles == true)
                            {
                                dicomPeerToPeerConfig.AddDefinitionFile(reader.ReadElementString("DefinitionFile"));
                                reader.Read();
                                if ((reader.NodeType == XmlNodeType.EndElement) &&
                                    (reader.Name == "DefinitionFiles"))
                                {
                                    reader.Read();
                                    readingDefinitionFiles = false;
                                }
                            }

                            _peerToPeerConfigCollection.Add(dicomPeerToPeerConfig);

                            reader.ReadEndElement();
                        }
                        else
                        {
                            Hl7PeerToPeerConfig hl7PeerToPeerConfig = new Hl7PeerToPeerConfig();

                            reader.ReadStartElement("Hl7PeerToPeerConfiguration");
                            reader.ReadStartElement("FromActor");
                            reader.ReadStartElement("ActorName");
                            ActorTypeEnum actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType"));
                            System.String id = reader.ReadElementString("ActorId");
                            ActorName actorName = new ActorName(actorType, id);
                            hl7PeerToPeerConfig.FromActorName = actorName;
                            reader.ReadEndElement();
                            hl7PeerToPeerConfig.FromActorAeTitle = reader.ReadElementString("AeTitle");
                            reader.ReadEndElement();
                            reader.ReadStartElement("ToActor");
                            reader.ReadStartElement("ActorName");
                            actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType"));
                            id = reader.ReadElementString("ActorId");
                            actorName = new ActorName(actorType, id);
                            hl7PeerToPeerConfig.ToActorName = actorName;
                            reader.ReadEndElement();
                            hl7PeerToPeerConfig.ToActorAeTitle = reader.ReadElementString("AeTitle");
                            hl7PeerToPeerConfig.ToActorIpAddress = reader.ReadElementString("IpAddress");
                            reader.ReadEndElement();
                            hl7PeerToPeerConfig.PortNumber = UInt16.Parse(reader.ReadElementString("PortNumber"));
                            hl7PeerToPeerConfig.MessageDelimiters.FromString(reader.ReadElementString("MessageDelimiters"));
                            System.String secureConnection = reader.ReadElementString("SecureConnection");
                            if (secureConnection == "True")
                            {
                                hl7PeerToPeerConfig.SecureConnection = true;
                            }
                            else
                            {
                                hl7PeerToPeerConfig.SecureConnection = false;
                            }

                            // read AutoValidate - added later - some config files may not contain this parameter
                            reader.ReadString();
                            if (reader.Name == "AutoValidate")
                            {
                                System.String autoValidate = reader.ReadElementString("AutoValidate");
                                if (autoValidate == "True")
                                {
                                    hl7PeerToPeerConfig.AutoValidate = true;
                                }
                                else
                                {
                                    hl7PeerToPeerConfig.AutoValidate = false;
                                }
                            }

                            hl7PeerToPeerConfig.ActorOption1 = reader.ReadElementString("ActorOption1");
                            hl7PeerToPeerConfig.ActorOption2 = reader.ReadElementString("ActorOption2");
                            hl7PeerToPeerConfig.ActorOption3 = reader.ReadElementString("ActorOption3");
                            hl7PeerToPeerConfig.SessionId = UInt16.Parse(reader.ReadElementString("SessionId"));

                            _peerToPeerConfigCollection.Add(hl7PeerToPeerConfig);

                            reader.ReadEndElement();
                        }
                    }

                    reader.ReadEndElement();
                }

                reader.Close();
            }
            catch (System.Exception e)
            {
                System.String message = System.String.Format("Failed to read configuration file: \"{0}\". Error: \"{1}\"", configurationFilename, e.Message);
                throw new System.SystemException(message, e);
            }
        }