Ejemplo n.º 1
0
        /// <summary>
        /// Trigger the DICOM Client Verification (E-ECHO-RQ).
        /// </summary>
        /// <param name="actorType">Destination Actor Type.</param>
        /// <returns>Boolean indicating success or failure.</returns>
        public bool TriggerActorDicomClientVerificationInstances(ActorTypeEnum actorType)
        {
            bool triggerResult = false;

            // can only trigger an actor that is started
            if (_actorState == ActorStateEnum.ActorStarted)
            {
                triggerResult = true;

                ActorNameCollection activeDestinationActors = ActorConnectionCollection.IsEnabled(actorType);
                foreach (ActorName activeActorName in activeDestinationActors)
                {
                    DicomClient dicomClient = GetDicomClient(activeActorName);
                    if (dicomClient != null)
                    {
                        if (dicomClient.TriggerClientVerification(activeActorName) == false)
                        {
                            // set returned result - but continue with other triggers
                            triggerResult = false;
                        }
                    }
                }
            }

            return(triggerResult);
        }
Ejemplo n.º 2
0
    public static IEnumerator SpawnGroup(
        ActorTypeEnum actorType,
        int count,
        float timeBetweenEntities,
        bool outsideScreen,
        SpawnDirection dir)
    {
        for (int entity = 0; entity < count; ++entity)
        {
            var     spawn  = EnemyManager.Instance.GetEnemyFromCache(actorType);
            float   offset = 2.0f;
            Vector3 pos;
            if (outsideScreen)
            {
                pos = GetPointOutsideScreen(dir, offset, Random.value * 0.5f);
            }
            else
            {
                pos = GetPointInsideArena(1.0f, 1.0f);
            }

            spawn.transform.position = pos;
            spawn.SetActive(true);
            if (timeBetweenEntities != 0.0)
            {
                yield return(new WaitForSeconds(timeBetweenEntities));
            }
        }
    }
Ejemplo n.º 3
0
        /// <summary>
        /// Actor enum based type from string.
        /// </summary>
        /// <param name="type">Actor type as String.</param>
        /// <returns>Actor Type as Enum.</returns>
        public static ActorTypeEnum TypeEnum(System.String type)
        {
            ActorTypeEnum typeEnum = ActorTypeEnum.Unknown;

            if (type == "AdtPatientRegistration")
            {
                typeEnum = ActorTypeEnum.AdtPatientRegistration;
            }
            else if (type == "OrderPlacer")
            {
                typeEnum = ActorTypeEnum.OrderPlacer;
            }
            else if (type == "DssOrderFiller")
            {
                typeEnum = ActorTypeEnum.DssOrderFiller;
            }
            else if (type == "AcquisitionModality")
            {
                typeEnum = ActorTypeEnum.AcquisitionModality;
            }
            else if (type == "ImageManager")
            {
                typeEnum = ActorTypeEnum.ImageManager;
            }
            else if (type == "ImageArchive")
            {
                typeEnum = ActorTypeEnum.ImageArchive;
            }
            else if (type == "PerformedProcedureStepManager")
            {
                typeEnum = ActorTypeEnum.PerformedProcedureStepManager;
            }
            else if (type == "ImageDisplay")
            {
                typeEnum = ActorTypeEnum.ImageDisplay;
            }
            else if (type == "EvidenceCreator")
            {
                typeEnum = ActorTypeEnum.EvidenceCreator;
            }
            else if (type == "ReportManager")
            {
                typeEnum = ActorTypeEnum.ReportManager;
            }
            else if (type == "PrintComposer")
            {
                typeEnum = ActorTypeEnum.PrintComposer;
            }
            else if (type == "PrintServer")
            {
                typeEnum = ActorTypeEnum.PrintServer;
            }

            return(typeEnum);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Get the Actor Id of the first instance of the given peer actor type DicomServer
 /// in this actor.
 /// </summary>
 /// <param name="actorType">Peer actor type.</param>
 /// <returns>String - Actor Id.</returns>
 public String GetFirstActorIdFromDicomServer(ActorTypeEnum actorType)
 {
     foreach (DicomServer dicomServer in _dicomServers.Values)
     {
         if (dicomServer.ActorName.Type == actorType)
         {
             return(dicomServer.ActorName.Id);
         }
     }
     return(String.Empty);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Update the given DicomServer using the Destination Actor Configuration.
 /// </summary>
 /// <param name="serverActorName">DicomServer Actor Name.</param>
 /// <param name="clientActorType">DicomClient Actor Type.</param>
 /// <param name="commonConfig">Common Configuration.</param>
 /// <param name="peerToPeerConfigCollection">Peer to Peer Configuration collection.</param>
 protected void UpdateDicomServer(ActorName serverActorName, ActorTypeEnum clientActorType, CommonConfig commonConfig, BasePeerToPeerConfigCollection peerToPeerConfigCollection)
 {
     foreach (BasePeerToPeerConfig basePeerToPeerConfig in peerToPeerConfigCollection)
     {
         if ((basePeerToPeerConfig is DicomPeerToPeerConfig) &&
             (basePeerToPeerConfig.FromActorName.TypeId == serverActorName.TypeId) &&
             (basePeerToPeerConfig.ToActorName.Type == clientActorType))
         {
             DicomServer dicomServer = GetDicomServer(basePeerToPeerConfig.ToActorName);
             if (dicomServer != null)
             {
                 dicomServer.UpdateConfig(commonConfig, (DicomPeerToPeerConfig)basePeerToPeerConfig);
             }
         }
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Return a list of all the destination actor names of the given actor type that are active.
        /// </summary>
        /// <param name="actorType">Destination actor type.</param>
        /// <returns>ActorNameCollection - all active destination actor names of the given actor type.</returns>
        public ActorNameCollection IsEnabled(ActorTypeEnum actorType)
        {
            ActorNameCollection actorNames = new ActorNameCollection();

            // search for connection to destination with the given actor type
            foreach (ActorConnection actorConnection in this)
            {
                if ((actorConnection.ActorName.Type == actorType) &&
                    (actorConnection.IsActive == true))
                {
                    // return this active actor name
                    actorNames.Add(actorConnection.ActorName);
                }
            }

            return(actorNames);
        }
Ejemplo n.º 7
0
    public GoCache GetCacheFromType(ActorTypeEnum type)
    {
        GoCache result = null;

        switch (type)
        {
        case ActorTypeEnum.SmallWalker: result = EnemyManager.Instance.CacheSmallWalker; break;

        case ActorTypeEnum.LargeWalker: result = EnemyManager.Instance.CacheLargeWalker; break;

        case ActorTypeEnum.SmallCharger: result = EnemyManager.Instance.CacheCharger; break;

        case ActorTypeEnum.Caster: result = EnemyManager.Instance.CacheCaster; break;

        default: Debug.LogError("EnemyManager: Unknown enemy type: " + type.ToString()); break;
        }
        return(result);
    }
Ejemplo n.º 8
0
    public void EnemyExplosion(ActorTypeEnum type, Vector3 pos, int count, float force)
    {
        if (currentDeed_.Deed == DeedEnum.Sandbox)
        {
            // Not pretty... but we have to add these newly spawned enemies to the total count of the sandbox
            currentDeed_.UpdatedKillReq += count;
            TextHowTo.text = string.Format(currentDeed_.Req, currentDeed_.UpdatedKillReq);
        }

        for (int i = 0; i < count; ++i)
        {
            var spawn = EnemyManager.Instance.GetEnemyFromCache(type);
            spawn.transform.position = pos;
            var actor = spawn.GetComponent <ActorBase>();
            actor.AddForce(RndUtil.RandomInsideUnitCircle().normalized *force);
            spawn.SetActive(true);
        }
    }
Ejemplo n.º 9
0
        /// <summary>
        /// Disable the connection to a specific actor.
        /// </summary>
        /// <param name="actorType">Destination actor type.</param>
        /// <param name="id">Destination actor id.</param>
        /// <returns>bool - destination disabled true/false. False indicates that the destination actor was not found.</returns>
        public bool Disable(ActorTypeEnum actorType, System.String id)
        {
            bool      disabled  = false;
            ActorName actorName = new ActorName(actorType, id);

            // search for connection to destination with the given actor name
            foreach (ActorConnection actorConnection in this)
            {
                if (actorConnection.ActorName == actorName)
                {
                    // disable this specific actor connection
                    actorConnection.IsActive = false;
                    disabled = true;
                }
            }

            return(disabled);
        }
Ejemplo n.º 10
0
        public bool OnKill(ActorTypeEnum type)
        {
            if (ValidTargets.Contains(ActorTypeEnum.Any) || ValidTargets.Contains(type))
            {
                if (DeedCurrentScore >= UpdatedKillReq)
                {
                    return(false);
                }

                DeedCurrentScore++;
                if (DeedCurrentScore == UpdatedKillReq)
                {
                    DeedComplete = true;
                    GameManager.Instance.PlayerScript.Victory();
                }
                return(true);
            }
            return(false);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Trigger the Actor Instances of the given Actor Type.
        /// </summary>
        /// <param name="actorType">Destination Actor Type.</param>
        /// <param name="trigger">Trigger message.</param>
        /// <param name="awaitCompletion">Boolean indicating whether this a synchronous call or not.</param>
        /// <returns>Boolean indicating success or failure.</returns>
        public bool TriggerActorInstances(ActorTypeEnum actorType, BaseTrigger trigger, bool awaitCompletion)
        {
            bool triggerResult = false;

            // can only trigger an actor that is started
            if (_actorState == ActorStateEnum.ActorStarted)
            {
                triggerResult = true;

                ActorNameCollection activeDestinationActors = ActorConnectionCollection.IsEnabled(actorType);
                foreach (ActorName activeActorName in activeDestinationActors)
                {
                    if (trigger is Hl7Trigger)
                    {
                        Hl7Client hl7Client = GetHl7Client(activeActorName);
                        if (hl7Client != null)
                        {
                            if (hl7Client.TriggerClient(activeActorName, trigger, awaitCompletion) == false)
                            {
                                // set returned result - but continue with other triggers
                                triggerResult = false;
                            }
                        }
                    }
                    else
                    {
                        DicomClient dicomClient = GetDicomClient(activeActorName);
                        if (dicomClient != null)
                        {
                            if (dicomClient.TriggerClient(activeActorName, trigger, awaitCompletion) == false)
                            {
                                // set returned result - but continue with other triggers
                                triggerResult = false;
                            }
                        }
                    }
                }
            }

            return(triggerResult);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Add a reponse trigger to the Actor.
 /// </summary>
 /// <param name="actorType">Destination Actor Type.</param>
 /// <param name="trigger">Trigger message.</param>
 public void AddResponseTriggerToActor(ActorTypeEnum actorType, BaseTrigger trigger)
 {
     // can only load and actor that is started
     if (_actorState == ActorStateEnum.ActorStarted)
     {
         ActorNameCollection activeDestinationActors = ActorConnectionCollection.IsEnabled(actorType);
         foreach (ActorName activeActorName in activeDestinationActors)
         {
             if (trigger is Hl7Trigger)
             {
                 Hl7Server hl7Server = GetHl7Server(activeActorName);
                 if ((hl7Server != null) &&
                     (hl7Server is Hl7QueryServer))
                 {
                     Hl7QueryServer hl7QueryServer = (Hl7QueryServer)hl7Server;
                     hl7QueryServer.AddResponseTrigger(activeActorName, trigger);
                 }
             }
         }
     }
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Add an HL7Client for the given Destination Actor Name and Configuration.
        /// </summary>
        /// <param name="hl7ClientType">Hl7 Client Type.</param>
        /// <param name="toActorType">To Actor Type.</param>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="peerToPeerConfigCollection">Peer to Peer Configuration collection.</param>
        protected void AddHl7Client(Hl7ClientTypeEnum hl7ClientType, ActorTypeEnum toActorType, CommonConfig commonConfig, BasePeerToPeerConfigCollection peerToPeerConfigCollection)
        {
            foreach (BasePeerToPeerConfig basePeerToPeerConfig in peerToPeerConfigCollection)
            {
                if ((basePeerToPeerConfig is Hl7PeerToPeerConfig) &&
                    (basePeerToPeerConfig.FromActorName.TypeId == _actorName.TypeId) &&
                    (basePeerToPeerConfig.ToActorName.Type == toActorType))
                {
                    Hl7Client hl7Client = ClientServerFactory.CreateHl7Client(hl7ClientType, this, basePeerToPeerConfig.ToActorName, commonConfig, (Hl7PeerToPeerConfig)basePeerToPeerConfig);
                    if (hl7Client != null)
                    {
                        SubscribeEvent(hl7Client);
                        _hl7Clients.Add(hl7Client.ActorName.TypeId, hl7Client);

                        // Initialize the connection with the to actor as being active.
                        // - this can always be overruled by the application later.
                        SetActorDefaultConnectionActive(basePeerToPeerConfig.ToActorName);
                    }
                }
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Add the given DicomServer using the Destination Actor Configuration.
        /// </summary>
        /// <param name="dicomServerType">Dicom Server Type.</param>
        /// <param name="fromActorType">From Actor Type.</param>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="peerToPeerConfigCollection">Peer to Peer Configuration collection.</param>
        protected void AddDicomServer(DicomServerTypeEnum dicomServerType, ActorTypeEnum fromActorType, CommonConfig commonConfig, BasePeerToPeerConfigCollection peerToPeerConfigCollection)
        {
            foreach (BasePeerToPeerConfig basePeerToPeerConfig in peerToPeerConfigCollection)
            {
                if ((basePeerToPeerConfig is DicomPeerToPeerConfig) &&
                    (basePeerToPeerConfig.ToActorName.TypeId == _actorName.TypeId) &&
                    (basePeerToPeerConfig.FromActorName.Type == fromActorType))
                {
                    DicomServer dicomServer = ClientServerFactory.CreateDicomServer(dicomServerType, this, basePeerToPeerConfig.FromActorName);
                    if (dicomServer != null)
                    {
                        dicomServer.ApplyConfig(commonConfig, (DicomPeerToPeerConfig)basePeerToPeerConfig);
                        SubscribeEvent(dicomServer);
                        _dicomServers.Add(dicomServer.ActorName.TypeId, dicomServer);

                        // Initialize the connection with the from actor as being active.
                        // - this can always be overruled by the application later.
                        SetActorDefaultConnectionActive(basePeerToPeerConfig.FromActorName);
                    }
                }
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Actor string based type from enum.
        /// </summary>
        /// <param name="actorType">Actor Type as Enum.</param>
        /// <returns>Actor Type as String.</returns>
        public static System.String Type(ActorTypeEnum actorType)
        {
            System.String type = "Unknown";

            switch (actorType)
            {
            case ActorTypeEnum.AdtPatientRegistration: type = "AdtPatientRegistration"; break;

            case ActorTypeEnum.OrderPlacer: type = "OrderPlacer"; break;

            case ActorTypeEnum.DssOrderFiller: type = "DssOrderFiller"; break;

            case ActorTypeEnum.AcquisitionModality: type = "AcquisitionModality"; break;

            case ActorTypeEnum.ImageManager: type = "ImageManager"; break;

            case ActorTypeEnum.ImageArchive: type = "ImageArchive"; break;

            case ActorTypeEnum.PerformedProcedureStepManager: type = "PerformedProcedureStepManager"; break;

            case ActorTypeEnum.ImageDisplay: type = "ImageDisplay"; break;

            case ActorTypeEnum.EvidenceCreator: type = "EvidenceCreator"; break;

            case ActorTypeEnum.ReportManager: type = "ReportManager"; break;

            case ActorTypeEnum.PrintComposer: type = "PrintComposer"; break;

            case ActorTypeEnum.PrintServer: type = "PrintServer"; break;

            default:
                break;
            }

            return(type);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Enable the connection to a specific actor.
        /// </summary>
        /// <param name="actorType">Destination actor type.</param>
        /// <param name="id">Destination actor id.</param>
        /// <returns>bool - destination enabled true/false. False indicates that the destination actor was not found.</returns>
        public bool Enable(ActorTypeEnum actorType, System.String id)
        {
            bool enabled = false;
            ActorName actorName = new ActorName(actorType, id);

            // search for connection to destination with the given actor name
            foreach (ActorConnection actorConnection in this)
            {
                if (actorConnection.ActorName == actorName)
                {
                    // enable this specific actor connection
                    actorConnection.IsActive = true;
                    enabled = true;
                }
            }

            return enabled;
        }
Ejemplo n.º 17
0
 public RestrictedController(ActorTypeEnum restriction)
 {
     this.restriction = restriction;
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Return a list of all the destination actor names of the given actor type that are active.
        /// </summary>
        /// <param name="actorType">Destination actor type.</param>
        /// <returns>ActorNameCollection - all active destination actor names of the given actor type.</returns>
        public ActorNameCollection IsEnabled(ActorTypeEnum actorType)
        {
            ActorNameCollection actorNames = new ActorNameCollection();

            // search for connection to destination with the given actor type
            foreach (ActorConnection actorConnection in this)
            {
                if ((actorConnection.ActorName.Type == actorType) &&
                    (actorConnection.IsActive == true))
                {
                    // return this active actor name
                    actorNames.Add(actorConnection.ActorName);
                }
            }

            return actorNames;
        }
Ejemplo n.º 19
0
 /// <summary>
 /// Add a reponse trigger to the Actor.
 /// </summary>
 /// <param name="actorType">Destination Actor Type.</param>
 /// <param name="trigger">Trigger message.</param>
 public void AddResponseTriggerToActor(ActorTypeEnum actorType, BaseTrigger trigger)
 {
     // can only load and actor that is started
     if (_actorState == ActorStateEnum.ActorStarted)
     {
         ActorNameCollection activeDestinationActors = ActorConnectionCollection.IsEnabled(actorType);
         foreach(ActorName activeActorName in activeDestinationActors)
         {
             if (trigger is Hl7Trigger)
             {
                 Hl7Server hl7Server = GetHl7Server(activeActorName);
                 if ((hl7Server != null) &&
                     (hl7Server is Hl7QueryServer))
                 {
                     Hl7QueryServer hl7QueryServer = (Hl7QueryServer)hl7Server;
                     hl7QueryServer.AddResponseTrigger(activeActorName, trigger);
                 }
             }
         }
     }
 }
Ejemplo n.º 20
0
 public void ReturnEnemyToCache(ActorTypeEnum type, GameObject go)
 {
     GetCacheFromType(type).ReturnInstance(go);
 }
Ejemplo n.º 21
0
 public GameObject GetEnemyFromCache(ActorTypeEnum type)
 {
     return(GetCacheFromType(type).GetInstance());
 }
Ejemplo n.º 22
0
        /// <summary>
        /// Actor string based type from enum.
        /// </summary>
        /// <param name="actorType">Actor Type as Enum.</param>
        /// <returns>Actor Type as String.</returns>
        public static System.String Type(ActorTypeEnum actorType)
        {
            System.String type = "Unknown";

            switch(actorType)
            {
                case ActorTypeEnum.AdtPatientRegistration: type = "AdtPatientRegistration"; break;
                case ActorTypeEnum.OrderPlacer: type = "OrderPlacer"; break;
                case ActorTypeEnum.DssOrderFiller: type = "DssOrderFiller"; break;
                case ActorTypeEnum.AcquisitionModality: type = "AcquisitionModality"; break;
                case ActorTypeEnum.ImageManager: type = "ImageManager"; break;
                case ActorTypeEnum.ImageArchive: type = "ImageArchive"; break;
                case ActorTypeEnum.PerformedProcedureStepManager: type = "PerformedProcedureStepManager"; break;
                case ActorTypeEnum.ImageDisplay: type = "ImageDisplay"; break;
                case ActorTypeEnum.EvidenceCreator: type = "EvidenceCreator"; break;
                case ActorTypeEnum.ReportManager: type = "ReportManager"; break;
                case ActorTypeEnum.PrintComposer: type = "PrintComposer"; break;
                case ActorTypeEnum.PrintServer: type = "PrintServer"; break;
                default:
                    break;
            }

            return type;
        }
Ejemplo n.º 23
0
 /// <summary>
 /// Class constructor.
 /// </summary>
 /// <param name="type">Actor Type.</param>
 /// <param name="id">Actor Id.</param>
 public ActorName(ActorTypeEnum type, System.String id)
 {
     _type = type;
     _id   = id;
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Class constructor
 /// </summary>
 /// <param name="actorType">Actor Type.</param>
 /// <param name="id">Actor Id.</param>
 /// <param name="active">Active flag - true/false.</param>
 public ActorConnection(ActorTypeEnum actorType, System.String id, bool active)
 {
     _actorName = new ActorName(actorType, id);
     _active    = active;
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Get the Actor Id of the first instance of the given peer actor type DicomServer
 /// in this actor.
 /// </summary>
 /// <param name="actorType">Peer actor type.</param>
 /// <returns>String - Actor Id.</returns>
 public String GetFirstActorIdFromDicomServer(ActorTypeEnum actorType)
 {
     foreach (DicomServer dicomServer in _dicomServers.Values)
     {
         if (dicomServer.ActorName.Type == actorType)
         {
             return dicomServer.ActorName.Id;
         }
     }
     return String.Empty;
 }
Ejemplo n.º 26
0
        private bool ProcessEchoCommand(ActorTypeEnum actorType)
        {
            bool isOk = true;
            toolBarButtonLog.Enabled = true;
            toolBarButtonStop.Enabled = true;

            System.Threading.Thread.Sleep(250);

            if(!isCreated)
            {
                CreateIntegrationProfile();
                isCreated = true;
            }

            if(!isInitialized)
            {
                //Apply updated settings
                if (!UpdateConfig())
                    return false;

                wrapper.Initialize();
                isInitialized = true;
                isTerminated = false;
            }

            try
            {
                isOk = wrapper.SendVerification(actorType);
            }
            catch(Exception except)
            {
                string msg = string.Format("Error in DICOM Echo from due to {0}.",except.Message);
                isOk = false;
            }

            return isOk;
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Class constructor
 /// </summary>
 /// <param name="actorType">Actor Type.</param>
 /// <param name="id">Actor Id.</param>
 /// <param name="active">Active flag - true/false.</param>
 public ActorConnection(ActorTypeEnum actorType, System.String id, bool active)
 {
     _actorName = new ActorName(actorType, id);
     _active =  active;
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Trigger the DICOM Client Verification (E-ECHO-RQ).
        /// </summary>
        /// <param name="actorType">Destination Actor Type.</param>
        /// <returns>Boolean indicating success or failure.</returns>
        public bool TriggerActorDicomClientVerificationInstances(ActorTypeEnum actorType)
        {
            bool triggerResult = false;

            // can only trigger an actor that is started
            if (_actorState == ActorStateEnum.ActorStarted)
            {
                triggerResult = true;

                ActorNameCollection activeDestinationActors = ActorConnectionCollection.IsEnabled(actorType);
                foreach(ActorName activeActorName in activeDestinationActors)
                {
                    DicomClient dicomClient = GetDicomClient(activeActorName);
                    if (dicomClient != null)
                    {
                        if (dicomClient.TriggerClientVerification(activeActorName) == false)
                        {
                            // set returned result - but continue with other triggers
                            triggerResult = false;
                        }
                    }
                }
            }

            return triggerResult;
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Trigger the Actor Instances of the given Actor Type.
        /// </summary>
        /// <param name="actorType">Destination Actor Type.</param>
        /// <param name="trigger">Trigger message.</param>
        /// <param name="awaitCompletion">Boolean indicating whether this a synchronous call or not.</param>
        /// <returns>Boolean indicating success or failure.</returns>
        public bool TriggerActorInstances(ActorTypeEnum actorType, BaseTrigger trigger, bool awaitCompletion)
        {
            bool triggerResult = false;

            // can only trigger an actor that is started
            if (_actorState == ActorStateEnum.ActorStarted)
            {
                triggerResult = true;

                ActorNameCollection activeDestinationActors = ActorConnectionCollection.IsEnabled(actorType);
                foreach(ActorName activeActorName in activeDestinationActors)
                {
                    if (trigger is Hl7Trigger)
                    {
                        Hl7Client hl7Client = GetHl7Client(activeActorName);
                        if (hl7Client != null)
                        {
                            if (hl7Client.TriggerClient(activeActorName, trigger, awaitCompletion) == false)
                            {
                                // set returned result - but continue with other triggers
                                triggerResult = false;
                            }
                        }
                    }
                    else
                    {
                        DicomClient dicomClient = GetDicomClient(activeActorName);
                        if (dicomClient != null)
                        {
                            if (dicomClient.TriggerClient(activeActorName, trigger, awaitCompletion) == false)
                            {
                                // set returned result - but continue with other triggers
                                triggerResult = false;
                            }
                        }
                    }
                }
            }

            return triggerResult;
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Add the given DicomClient using the Destination Actor Configuration.
        /// </summary>
        /// <param name="dicomClientType">Dicom Client Type.</param>
        /// <param name="toActorType">To Actor Type.</param>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="peerToPeerConfigCollection">Peer to Peer Configuration collection.</param>
        protected void AddDicomClient(DicomClientTypeEnum dicomClientType, ActorTypeEnum toActorType, CommonConfig commonConfig, BasePeerToPeerConfigCollection peerToPeerConfigCollection)
        {
            foreach (BasePeerToPeerConfig basePeerToPeerConfig in peerToPeerConfigCollection)
            {
                if ((basePeerToPeerConfig is DicomPeerToPeerConfig) &&
                    (basePeerToPeerConfig.FromActorName.TypeId == _actorName.TypeId) &&
                    (basePeerToPeerConfig.ToActorName.Type == toActorType))
                {
                    DicomClient dicomClient = ClientServerFactory.CreateDicomClient(dicomClientType, this, basePeerToPeerConfig.ToActorName);
                    if (dicomClient != null)
                    {
                        dicomClient.ApplyConfig(commonConfig, (DicomPeerToPeerConfig)basePeerToPeerConfig);
                        SubscribeEvent(dicomClient);
                        _dicomClients.Add(dicomClient.ActorName.TypeId, dicomClient);

                        // Initialize the connection with the to actor as being active.
                        // - this can always be overruled by the application later.
                        SetActorDefaultConnectionActive(basePeerToPeerConfig.ToActorName);
                    }
                }
            }
        }
Ejemplo n.º 31
0
 /// <summary>
 /// Class constructor.
 /// </summary>
 /// <param name="type">Actor Type.</param>
 /// <param name="id">Actor Id.</param>
 public ActorName(ActorTypeEnum type, System.String id)
 {
     _type = type;
     _id = id;
 }
Ejemplo n.º 32
0
        /// <summary>
        /// Add an HL7Server for the given Destination Actor Name and Configuration.
        /// </summary>
        /// <param name="hl7ServerType">Hl7 Server Type.</param>
        /// <param name="fromActorType">From Actor Type.</param>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="peerToPeerConfigCollection">Peer to Peer Configuration collection.</param>
        protected void AddHl7Server(Hl7ServerTypeEnum hl7ServerType, ActorTypeEnum fromActorType, CommonConfig commonConfig, BasePeerToPeerConfigCollection peerToPeerConfigCollection)
        {
            foreach (BasePeerToPeerConfig basePeerToPeerConfig in peerToPeerConfigCollection)
            {
                if ((basePeerToPeerConfig is Hl7PeerToPeerConfig) &&
                    (basePeerToPeerConfig.ToActorName.TypeId == _actorName.TypeId) &&
                    (basePeerToPeerConfig.FromActorName.Type == fromActorType))
                {
                    Hl7Server hl7Server = ClientServerFactory.CreateHl7Server(hl7ServerType, this, basePeerToPeerConfig.FromActorName, commonConfig, (Hl7PeerToPeerConfig)basePeerToPeerConfig);
                    if (hl7Server != null)
                    {
                        SubscribeEvent(hl7Server);
                        _hl7Servers.Add(hl7Server.ActorName.TypeId, hl7Server);

                        // Initialize the connection with the from actor as being active.
                        // - this can always be overruled by the application later.
                        SetActorDefaultConnectionActive(basePeerToPeerConfig.FromActorName);
                    }
                }
            }
        }
Ejemplo n.º 33
0
 /// <summary>
 /// Send a C-ECHO-RQ Verification SOP Class to the given actor type
 /// </summary>
 public bool SendVerification(ActorTypeEnum actorType)
 {
     // send the Verification SOP Class
     return(_acquisitionModality.TriggerActorDicomClientVerificationInstances(actorType));
 }
Ejemplo n.º 34
0
 /// <summary>
 /// Update the given DicomServer using the Destination Actor Configuration.
 /// </summary>
 /// <param name="serverActorName">DicomServer Actor Name.</param>
 /// <param name="clientActorType">DicomClient Actor Type.</param>
 /// <param name="commonConfig">Common Configuration.</param>
 /// <param name="peerToPeerConfigCollection">Peer to Peer Configuration collection.</param>
 protected void UpdateDicomServer(ActorName serverActorName, ActorTypeEnum clientActorType, CommonConfig commonConfig, BasePeerToPeerConfigCollection peerToPeerConfigCollection)
 {
     foreach (BasePeerToPeerConfig basePeerToPeerConfig in peerToPeerConfigCollection)
     {
         if ((basePeerToPeerConfig is DicomPeerToPeerConfig) &&
             (basePeerToPeerConfig.FromActorName.TypeId == serverActorName.TypeId) &&
             (basePeerToPeerConfig.ToActorName.Type == clientActorType))
         {
             DicomServer dicomServer = GetDicomServer(basePeerToPeerConfig.ToActorName);
             if (dicomServer != null)
             {
                 dicomServer.UpdateConfig(commonConfig, (DicomPeerToPeerConfig)basePeerToPeerConfig);
             }
         }
     }
 }
Ejemplo n.º 35
0
 /// <summary>
 /// Send a C-ECHO-RQ Verification SOP Class to the given actor type
 /// </summary>
 public bool SendVerification(ActorTypeEnum actorType)
 {
     // send the Verification SOP Class
     return _acquisitionModality.TriggerActorDicomClientVerificationInstances(actorType);
 }
Ejemplo n.º 36
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);
            }
        }