public bool RecursiveCheckComponent(ComponentWrapper component) { ReferenceData refData = this[component]; this.CheckComponent(component); bool recurcive = OnCheckComponent(component); if (component.Checked == true) { foreach (ComponentWrapper dependComponent in refData.DependsFrom) { if (dependComponent.Checked == false) { dependComponent.Checked = true; RecursiveCheckComponent(dependComponent); recurcive = true; } } } else { foreach (ComponentWrapper dependComponent in refData.RequiredBy) { if (dependComponent.Checked == true) { dependComponent.Checked = false; RecursiveCheckComponent(dependComponent); recurcive = true; } } } return(recurcive); }
public static bool UnresolvedComponents(ComponentWrapper component, ReferenceInfo info) { if (!DefaultComponents(component, info)) { return(false); } bool result = false; if (component.Checked) { result = true; ReferenceData refData = info[component]; foreach (ComponentWrapper library in refData.Realization) { if (library.ComponentType == ComponentTypeWrapper.Library) { if (library.Checked) { result = false; break; } } } } return(result); }
public override bool OnCheckComponent(ComponentWrapper component) { bool recursive = false; ReferenceData refData = this[component]; if (refData.Wrapper is LibraryWrapper) { if (component.Checked) { foreach (ComponentWrapper libcat in refData.Realization) { ReferenceData libcatRefData = this[libcat]; foreach (ComponentWrapper library in libcatRefData.Realization) { if ((library.Equals(component) == false) && (library.Checked)) { library.Checked = false; recursive |= RecursiveCheckComponent(library); } } } } recursive |= RecursiveAddComponent(component); } return(recursive); }
public ReferenceData this[ComponentWrapper component] { get { return(this.References[component]); } }
public static bool AllComponents(ComponentWrapper component, ReferenceInfo info) { if (!DefaultComponents(component, info)) { return(false); } return(component.Checked); }
public static ComponentWrapper GetComponentWrapper(BaseWrapper wrapper, ComponentTypeWrapper type) { ComponentWrapper component = BaseWrapper.Wrap <ComponentWrapper>(new MFComponent((MFComponentType)type, wrapper.InnerName, wrapper.InnerGuid, wrapper.InnerProjectPath, wrapper.InnerConditional)); component.Groups = wrapper.InnerGroups; component.InnerComponentType = wrapper.GetType(); return(component); }
public ReferenceInfo(Dictionary <ComponentWrapper, ReferenceData> references, ProjectWrapper Project, SolutionWrapper Solution, OnAddComponentHandler OnAddComponent) { this.ReadOnlyComponents = new List <ComponentWrapper>(); this.Project = Project; this.Solution = Solution; this.OnAddComponent = OnAddComponent; this.AddedComponents = new Collection <ComponentWrapper>(); this.RemovedComponents = new Collection <ComponentWrapper>(); if (references != null) { this.References = references; } else { this.References = new Dictionary <ComponentWrapper, ReferenceData>(); foreach (BaseWrapper wrapper in GetComponents()) { ComponentWrapper component = ComponentWrapper.GetComponentWrapper(wrapper); References.Add(component, new ReferenceData(wrapper)); } foreach (ComponentWrapper component in this.References.Keys) { BaseWrapper wrapper = this[component].Wrapper; switch (component.ComponentType) { case ComponentTypeWrapper.Library: LibraryWrapper library = wrapper as LibraryWrapper; Debug.Assert(library != null); library.Dependencies = GetComponents(library.Dependencies); if ((library.LibraryCategory != null) && (library.HasLibraryCategory)) { library.LibraryCategory = GetComponent(library.LibraryCategory); } break; case ComponentTypeWrapper.Feature: FeatureWrapper feature = wrapper as FeatureWrapper; Debug.Assert(feature != null); feature.FeatureDependencies = GetComponents(feature.FeatureDependencies); feature.ComponentDependencies = GetComponents(feature.ComponentDependencies); break; case ComponentTypeWrapper.LibraryCategory: LibraryCategoryWrapper libcat = wrapper as LibraryCategoryWrapper; Debug.Assert(libcat != null); libcat.FeatureAssociations = GetComponents(libcat.FeatureAssociations); break; default: Debug.Assert(false); break; } } this.Solution.TransportType.FeatureAssociations = GetComponents(this.Solution.TransportType.FeatureAssociations); } }
protected ComponentWrapper GetComponent(ComponentWrapper component) { ComponentWrapper rescomponent = this.FindComponent(component.Guid); if (rescomponent != null) { ComponentWrapper.Copy(rescomponent, component); } return(rescomponent); }
public Collection <ComponentNode> GetDependsFrom(ComponentWrapper component) { ReferenceData refData = this[component]; Collection <ComponentNode> nodes = new Collection <ComponentNode>(); foreach (ComponentWrapper reference in refData.DependsFrom) { nodes.Add(new ComponentNode(reference, null)); } return(nodes); }
protected void CheckComponent(ComponentWrapper component) { if (component.Checked) { this.ExchangeComponent(component, this.RemovedComponents, this.AddedComponents); } else { this.ExchangeComponent(component, this.AddedComponents, this.RemovedComponents); } }
public void GetRefList(ComponentWrapper component, out List <ComponentWrapper> refList) { refList = new List <ComponentWrapper>(); ReferenceData refData = this.References[component]; foreach (ComponentWrapper item in refData.RequiredBy) { if (item.Checked) { refList.Add(item); } } }
protected override void OnComponentRefs(ComponentWrapper component) { ReferenceData refData = this.References[component]; FeatureWrapper feature = refData.Wrapper as FeatureWrapper; if (feature != null) { foreach (ComponentWrapper dependency in feature.FeatureDependencies) { MutualReference(component, dependency); } } }
private void ExchangeComponent(ComponentWrapper component, Collection <ComponentWrapper> a, Collection <ComponentWrapper> b) { if (a.Contains(component) == false) { if (b.Contains(component) == false) { b.Add(component); } } else { a.Remove(component); } }
protected CollectionWrapper <ComponentWrapper, MFComponent> GetComponents(CollectionWrapper <ComponentWrapper, MFComponent> components) { Collection <ComponentWrapper> result = new Collection <ComponentWrapper>(); foreach (ComponentWrapper component in components) { ComponentWrapper rescomponent = this.FindComponent(component.Guid); if (rescomponent != null) { ComponentWrapper.Copy(rescomponent, component); result.Add(rescomponent); } } return(result); }
public ReferenceData this[string guid] { get { ComponentWrapper component = this.FindComponent(guid); if (component != null) { return(this[component]); } else { return(null); } } }
protected override bool OnAddNode(BaseWrapper wrapper) { ComponentWrapper component = wrapper as ComponentWrapper; if (component != null) { switch (component.ComponentType) { case ComponentTypeWrapper.Feature: case ComponentTypeWrapper.Library: case ComponentTypeWrapper.LibraryCategory: return(true); } } return(false); }
protected void AddReadonly(ComponentWrapper component) { if (this.ReadOnlyComponents.Contains(component) == false) { this.ReadOnlyComponents.Add(component); } if (component.ComponentType == ComponentTypeWrapper.Feature) { if (this.Project.IsClrProject) { if (this.Project.Features.Contains(component) == false) { this.Project.Features.Add(component); } } } }
private ComponentWrapper FindComponent(string guid) { ComponentWrapper result = null; guid = guid.ToUpper(); if (guidToInfoHash.TryGetValue(guid, out result) == false) { foreach (ComponentWrapper item in this.References.Keys) { if (item.IsSameGuid(guid)) { guidToInfoHash.Add(item.Guid.ToUpper(), item); result = item; break; } } } return(result); }
protected void MutualReference(ComponentWrapper component, ComponentWrapper dependency, ReferenceType type) { ReferenceData thisReference = this.References[component]; if (type == ReferenceType.Realization) { if (!thisReference.Realization.Contains(dependency)) { thisReference.Realization.Add(dependency); } } else { if (!thisReference.DependsFrom.Contains(dependency)) { thisReference.DependsFrom.Add(dependency); } } ReferenceData dependReference = this.References[dependency]; if (type == ReferenceType.Realization) { if (!dependReference.Realization.Contains(component)) { dependReference.Realization.Add(component); } } else { if (type == ReferenceType.Dependency) { if (!dependReference.RequiredBy.Contains(component)) { dependReference.RequiredBy.Add(component); } } } }
protected override void CheckComponents() { if (this.FeaturesInfo != null) { foreach (ComponentWrapper feature in this.FeaturesInfo.CheckedComponents) { feature.Checked = true; } } foreach (LibraryWrapper template in this.Templates) { ComponentWrapper component = ComponentWrapper.GetComponentWrapper(template); this.References.Add(component, new ReferenceData(template)); MutualReference(template.LibraryCategory, component, ReferenceType.Realization); } foreach (ComponentWrapper component in this.References.Keys) { ReferenceData refData = this[component]; bool add = component.Checked; switch (component.ComponentType) { case ComponentTypeWrapper.LibraryCategory: LibraryCategoryWrapper libcat = refData.Wrapper as LibraryCategoryWrapper; Debug.Assert(libcat != null); if ((libcat.Required == true) || (this.IsTransport(libcat))) { add = true; } break; case ComponentTypeWrapper.Library: LibraryWrapper library = refData.Wrapper as LibraryWrapper; if (library.IsTemplate) { component.Name = "Generate Template"; } Debug.Assert(library != null); if (library.Required == true) { component.Checked = true; add = true; } break; case ComponentTypeWrapper.Feature: FeatureWrapper feature = refData.Wrapper as FeatureWrapper; Debug.Assert(feature != null); if (feature.Required == true) { component.Checked = true; add = true; } break; default: Debug.Assert(false); break; } if (add) { RecursiveAddComponent(component); } } foreach (ComponentWrapper component in this.References.Keys) { if (DefaultComponents(component, this)) { this.ReadOnlyComponents.Add(component); } break; } }
public static bool AddComponentDefault(ComponentWrapper component, ReferenceInfo info) { return(true); }
ComponentWrapper GetAutoselectLibrary(ComponentWrapper component) { Debug.Assert(component.ComponentType == ComponentTypeWrapper.LibraryCategory); ReferenceData refData = this[component]; LibraryCategoryWrapper libcat = refData.Wrapper as LibraryCategoryWrapper; Debug.Assert(libcat != null); ComponentWrapper defaultLib = null; ComponentWrapper stubLib = null; ComponentWrapper templateLib = null; ComponentWrapper bootloaderLib = null; ComponentWrapper projectLib = null; LibraryWrapper defaultWrapper = null; bool alterLib = false; foreach (ComponentWrapper library in refData.Realization) { LibraryWrapper wrapper = this[library].Wrapper as LibraryWrapper; Debug.Assert(wrapper != null); if (wrapper != null) { if (this.Project.Libraries.Contains(library)) { if (wrapper.IsStub == false) { projectLib = library; } else { stubLib = library; } } if (wrapper.IsStub) { if (stubLib == null) { stubLib = library; } } else if (wrapper.IsBootloaderLibrary()) { bootloaderLib = library; } else if (wrapper.IsTemplate) { templateLib = library; } else if (defaultLib == null) { defaultLib = library; defaultWrapper = wrapper; } else { alterLib = true; } } } if (libcat != null) { if (libcat.FeatureAssociations.Count != 0) { bool selected = false; foreach (ComponentWrapper feature in libcat.FeatureAssociations) { if (feature.Checked == true) { selected = true; break; } } if (selected) { if (this.Project.IsBootloaderProject() == false) { if ((alterLib == false) && (defaultLib != null)) { return(defaultLib); } if (projectLib != null) { return(projectLib); } } else if (bootloaderLib == null) { if (this.IsTransport(libcat)) { if (alterLib == false) { return(defaultLib); } if (stubLib != null) { return(stubLib); } if (((alterLib == true) || (defaultLib == null)) || (((templateLib != null) && (string.IsNullOrEmpty(defaultWrapper.CustomFilter))) && ((defaultWrapper.ProcessorSpecific != null) && (string.IsNullOrEmpty(defaultWrapper.ProcessorSpecific.Guid))))) { return(null); } return(defaultLib); } } else { return(bootloaderLib); } } else { if (this.IsTransport(libcat)) { return(null); } return(stubLib); } } else { if (!this.Project.IsBootloaderProject()) { if ((alterLib == false) && (defaultLib != null)) { if ((stubLib == null) && (templateLib == null)) { return(defaultLib); } if (!string.IsNullOrEmpty(defaultWrapper.CustomFilter) || ((defaultWrapper.ProcessorSpecific != null) && (!string.IsNullOrEmpty(defaultWrapper.ProcessorSpecific.Guid)))) { return(defaultLib); } } if (projectLib != null) { return(projectLib); } if ((stubLib != null) && (this.Project.Libraries.Contains(stubLib))) { return(stubLib); } } else if (bootloaderLib == null) { if (stubLib != null) { return(stubLib); } if (alterLib == false) { return(defaultLib); } } else { return(bootloaderLib); } } } return(null); }
public abstract bool OnCheckComponent(ComponentWrapper component);
protected abstract void OnComponentRefs(ComponentWrapper component);
protected override void OnComponentRefs(ComponentWrapper component) { ReferenceData refData = this.References[component]; switch (component.ComponentType) { case ComponentTypeWrapper.Feature: FeatureWrapper feature = refData.Wrapper as FeatureWrapper; Debug.Assert(feature != null); if (feature != null) { foreach (ComponentWrapper dependency in feature.ComponentDependencies) { MutualReference(component, dependency); } } break; case ComponentTypeWrapper.Library: LibraryWrapper library = refData.Wrapper as LibraryWrapper; Debug.Assert(library != null); if (library != null) { if ((library.LibraryCategory != null) && (library.HasLibraryCategory == true)) { if (this.ValidateLibrary(library)) { MutualReference(library.LibraryCategory, component, ReferenceType.Realization); } } foreach (ComponentWrapper dependency in library.Dependencies) { MutualReference(component, dependency); } } break; case ComponentTypeWrapper.LibraryCategory: LibraryCategoryWrapper libcat = refData.Wrapper as LibraryCategoryWrapper; Debug.Assert(libcat != null); if (libcat != null) { //foreach (ComponentWrapper assotiation in libcat.FeatureAssociations) //{ // MutualReference(assotiation, component,ReferenceType.Assotiation); //} if ((libcat.Level != LibraryLevelWrapper.CLR) && (libcat.Templates.Count != 0)) { LibraryWrapper template = PK.Wrapper.CreateLibrary( libcat.Name + "_" + this.Solution.Name, libcat.Level, @"Generates template code in your solution's DeviceCode directory for the given Library Category.The project will be generated in Solutions\" + this.Solution.Name + @"\DeviceCode\" + libcat.Name, PK.Wrapper.SpoClientPath + @"Solutions\" + this.Solution.Name + @"\DeviceCode\" + libcat.Name + @"\dotnetmf.proj", true, component); this.Templates.Add(template); } } break; } }
private static bool DefaultComponents(ComponentWrapper component, ReferenceInfo info) { return(component.ComponentType == ComponentTypeWrapper.LibraryCategory); }
public override bool OnCheckComponent(ComponentWrapper component) { return(false); }
private static bool DefaultComponents(ComponentWrapper component, ReferenceInfo info) { return(component.ComponentType == ComponentTypeWrapper.Feature); }
public bool IsFeatureReadOnly(ComponentWrapper component) { return(this.ReadOnlyComponents.Contains(component)); }
protected void MutualReference(ComponentWrapper component, ComponentWrapper dependency) { MutualReference(component, dependency, ReferenceType.Dependency); }