Ejemplo n.º 1
0
        /// <summary>
        /// Registers a group with the currently stored data.
        /// </summary>
        /// <param name="name">The name of the newly created group.</param>
        /// <returns>The registration ID of the group.</returns>
        public GroupRegistrationId Register(string name)
        {
            var definition = new GroupDefinition(name);

            definition.Parts = m_Objects.SelectMany(p => p.Value).ToList();
            definition.InternalConnections = m_Connections.Select(
                p => new PartImportToPartExportMap(p.Key, (IEnumerable <ExportRegistrationId>)p.Value));

            if (m_Schedule != null)
            {
                definition.Schedule = ScheduleDefinition.CreateDefinition(
                    definition.Id,
                    m_Schedule,
                    m_Actions.ToDictionary(p => p.Value, p => p.Key),
                    m_Conditions.ToDictionary(p => p.Value, p => p.Key));
            }

            if (m_GroupExport != null)
            {
                definition.GroupExport = GroupExportDefinition.CreateDefinition(
                    m_GroupExport.ContractName,
                    definition.Id,
                    NonLinkedExports());
            }

            if (m_GroupImports.Count > 0)
            {
                definition.GroupImports = m_GroupImports.Select(
                    i => GroupImportDefinition.CreateDefinition(
                        i.Value.ContractName,
                        definition.Id,
                        i.Value.InsertPoint,
                        i.Value.ObjectImports))
                                          .ToList();
            }

            Clear();

            m_Repository.AddGroup(definition, m_FileInfo);
            return(definition.Id);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds a new part group to the repository.
 /// </summary>
 /// <param name="group">The part group definition.</param>
 /// <param name="pluginFileInfo">The file info of the assembly which owns the group.</param>
 public void AddGroup(GroupDefinition group, PluginFileInfo pluginFileInfo)
 {
     m_Repository.AddGroup(group, pluginFileInfo);
 }