/// <summary> /// Insert/Update a component at the specefied path /// </summary> /// <param name="path">path as string array e.g. ["src","some","path"]</param> /// <param name="component">Componet to insert</param> /// <returns>Returns the inserted component</returns> public override TreeComponent InsertComponentAt(string[] path, TreeComponent component) { if (component == null || path == null || path.Length < 0) { return(null); } if (path.Length == 0) { return(UpdateComponent(component)); } TreeComponent tc = FindSubComponentInNode(path[0]); if (tc != null) { return(tc.InsertComponentAt(SubArray(path, 1, path.Length - 1), component)); } if (path.Length == 1) { components.Add(component); return(component); } tc = new DirComponent(path[0]); tc.Qualifier = SqQualifier.UNDEFINED; components.Add(tc); return(tc.InsertComponentAt(SubArray(path, 1, path.Length - 1), component)); }
/// <summary> /// Update the Information in this Component. This is necessary because a folder /// is generated for a file to insert and later the folder component /// with the information is inserted. /// </summary> /// <param name="component">Component that is used to update</param> /// <returns>Updated component</returns> public override TreeComponent UpdateComponent(TreeComponent component) { if (component != null && component is ProjectComponent && Name == component.Name) { base.UpdateComponent(component); return(this); } return(null); }
/// <summary> /// Update the Information in this Component. This is necessary because a folder /// is generated for a file to insert and later the folder component /// with the information is inserted. /// </summary> /// <param name="component">Component that is used to update</param> /// <returns>Updated component</returns> public override TreeComponent UpdateComponent(TreeComponent component) { if (component is FilComponent && Name == component.Name) { FilComponent f = (FilComponent)component; base.UpdateComponent(component); Language = f.Language; return(this); } return(null); }
/// <summary> /// Insert/Update a component at the specefied path /// </summary> /// <param name="path">path as string array e.g. ["src","some","path"]</param> /// <param name="component">Componet to insert</param> /// <returns>Returns the inserted component</returns> public override TreeComponent InsertComponentAt(string[] path, TreeComponent component) { if (component == null || path == null || path.Length <= 0) { return(null); } if (path.Length == 0 && Name == component.Name) { return(UpdateComponent(component)); } return(null); }
/// <summary> /// Update the Information in this Component. This is necessary because a folder /// is generated for a file to insert and later the folder component /// with the information is inserted. /// </summary> /// <param name="component">Component that is used to update</param> /// <returns>Updated component</returns> public virtual TreeComponent UpdateComponent(TreeComponent component) { if (component != null && Name == component.Name) { ID = component.ID; Key = component.Key; Name = component.Name; Path = component.Path; Qualifier = component.Qualifier; Metrics = component.Metrics; return(this); } return(null); }
/// <summary> /// Insert/Update a component at the specefied path /// </summary> /// <param name="path">path as string array e.g. ["src","some","path"]</param> /// <param name="component">Componet to insert</param> /// <returns>Returns the inserted component</returns> public abstract TreeComponent InsertComponentAt(string[] path, TreeComponent component);