internal void GetInstanceConfiguration(INodeDescriptor[] descriptors, bool SkipOpeningConfigurationFile, out bool CancelWasPressed)
 {
     CancelWasPressed = SkipOpeningConfigurationFile;
     foreach (INodeDescriptor item in descriptors)
     {
         InstanceConfiguration          ic  = GetInstanceConfiguration(item) as InstanceConfiguration;
         List <DataSourceConfiguration> dsc = new List <DataSourceConfiguration>();
         if (ic.DataSources != null)
         {
             dsc.AddRange(ic.DataSources);
         }
         DataSourceConfiguration newDataSource = new DataSourceConfiguration()
         {
             SelectedSource = DataSourceConfiguration.Source.OPCClient,
             SelectedSourceConfiguration =
                 new OPCDAClientSourceConfiguration(item,
                                                    out ConfigurationManagement.AdditionalResultInfo OperationResult,
                                                    CancelWasPressed)
         };
         if (OperationResult == ConfigurationManagement.AdditionalResultInfo.Cancel)
         {
             CancelWasPressed = true;
         }
         dsc.Add(newDataSource);
         if (dsc.Count > 0)
         {
             ic.DataSources = dsc.ToArray();
         }
     }
 }
        /// <summary>
        /// Gets the instance configuration.
        /// </summary>
        /// <param name="nodeUniqueIdentifier">The node unique identifier.</param>
        /// <returns>The interface providing access to the instance configuration.</returns>
        internal IInstanceConfiguration GetInstanceConfiguration(INodeDescriptor nodeUniqueIdentifier)
        {
            InstanceConfiguration sourceIC = new InstanceConfiguration(nodeUniqueIdentifier);

            if (Dictionary.TryGetValue(sourceIC.NodeDescriptor, out InstanceConfiguration ic))
            {
                return(ic);
            }
            else
            {
                Dictionary.Add(sourceIC.NodeDescriptor, sourceIC);
                return(sourceIC);
            }
        }
        private InstanceConfiguration Clone()
        {
            InstanceConfiguration ret = new InstanceConfiguration()
            {
                DataSources    = DataSources == null ? null : (DataSourceConfiguration[])this.DataSources.Clone(),
                NodeDescriptor = NodeDescriptor
            };

            if (DataSources != null)
            {
                for (int i = 0; i < DataSources.Length; i++)
                {
                    DataSources[i] = DataSources[i].Clone();
                }
            }
            return(ret);
        }