private void Handle_ComponentRegistration_Data(P2PData data)
            {
                UtilitiesLibrary.Data.CustomHashTable table = default(UtilitiesLibrary.Data.CustomHashTable);
                table = (CustomHashTable)data.Value;

                if (!table.Contains(CNDServiceDefinitions.CND_TABLE_COMPONENT_NAME))
                {
                    throw (new Exception("Can\'t register a component in CNDService becuase the parameter \'[Component Name]\' is missing."));
                }

                if (!table.Contains(CNDServiceDefinitions.CND_TABLE_HOST_NAME))
                {
                    throw (new Exception("Can\'t register a component in CNDService becuase the parameter \'[Hostname]\' is missing."));
                }

                if (!table.Contains(CNDServiceDefinitions.CND_TABLE_P2P_PORT_NUMBER))
                {
                    throw (new Exception("Can\'t register a component in CNDService becuase the parameter \'[P2PPortNumber]\' is missing."));
                }

                if (!table.Contains(CNDServiceDefinitions.CND_TABLE_IP_ADDRESS))
                {
                    throw (new Exception("Can\'t register a component in CNDService becuase the parameter \'[IPAddress]\' is missing."));
                }

                if (!table.Contains(CNDServiceDefinitions.CND_TABLE_APPLICATION_NAME))
                {
                    throw (new Exception("Can\'t register a component in CNDService becuase the parameter \'[Application Name]\' is missing."));
                }

                if (!table.Contains(CNDServiceDefinitions.CND_TABLE_APPLICATION_PROCESS_ID))
                {
                    throw (new Exception("Can\'t register a component in CNDService becuase the parameter \'[Application Process ID]\' is missing."));
                }

                string compName = System.Convert.ToString(table.Item(CNDServiceDefinitions.CND_TABLE_COMPONENT_NAME));

                compName = compName.ToUpper();
                string hostName             = System.Convert.ToString(table.Item(CNDServiceDefinitions.CND_TABLE_HOST_NAME));
                string P2PPortNumber        = System.Convert.ToString(table.Item(CNDServiceDefinitions.CND_TABLE_P2P_PORT_NUMBER));
                string IPAddress            = System.Convert.ToString(table.Item(CNDServiceDefinitions.CND_TABLE_IP_ADDRESS));
                string ApplicationName      = System.Convert.ToString(table.Item(CNDServiceDefinitions.CND_TABLE_APPLICATION_NAME));
                string ApplicationProcessID = System.Convert.ToString(table.Item(CNDServiceDefinitions.CND_TABLE_APPLICATION_PROCESS_ID));

                int portNumber = Convert.ToInt32(P2PPortNumber);

                this.SubscribeComponent(compName, hostName, IPAddress, portNumber, ApplicationName, ApplicationProcessID);
            }
示例#2
0
 internal CNDAddressingReg GetCNDAddressingRegister(string ComponentName)
 {
     UtilitiesLibrary.Data.CustomHashTable table = default(UtilitiesLibrary.Data.CustomHashTable);
     table = this.GetComponentRegistry(ComponentName);
     if (!(table == null))
     {
         string compName = System.Convert.ToString(table.Item(CNDServiceDefinitions.CND_TABLE_COMPONENT_NAME));
         compName = compName.ToUpper();
         string           hostName             = System.Convert.ToString(table.Item(CNDServiceDefinitions.CND_TABLE_HOST_NAME));
         string           P2PPortNumber        = System.Convert.ToString(table.Item(CNDServiceDefinitions.CND_TABLE_P2P_PORT_NUMBER));
         string           IPAddress            = System.Convert.ToString(table.Item(CNDServiceDefinitions.CND_TABLE_IP_ADDRESS));
         string           ApplicationName      = System.Convert.ToString(table.Item(CNDServiceDefinitions.CND_TABLE_APPLICATION_NAME));
         string           ApplicationProcessID = System.Convert.ToString(table.Item(CNDServiceDefinitions.CND_TABLE_APPLICATION_PROCESS_ID));
         string           RegistrationDateTime = System.Convert.ToString(table.Item(CNDServiceDefinitions.CND_TABLE_REGISTRATION_DATETIME));
         int              portNumber           = Convert.ToInt32(P2PPortNumber);
         CNDAddressingReg reg = new CNDAddressingReg(ComponentName, hostName, IPAddress, portNumber, ApplicationName, ApplicationProcessID, RegistrationDateTime);
         return(reg);
     }
     else
     {
         return(null);
     }
 }
 public ALDSData(string MessageID)
 {
     this._messageID       = MessageID.ToUpper();
     this._attributesTable = new CustomHashTable();
 }