public void UpdateProjectFile(TargetProject targetProject, TargetProjectComparisonResult projectComparison) { foreach (var newClass in projectComparison.ClassesToAdd) { this.AddClass(targetProject, newClass); } foreach (var updateClass in projectComparison.ClassesToUpdate) { this.UpdateClass(targetProject, updateClass); } }
public void ApplyChanges(TargetProjectComparisonResult comparison, string outputProjectPath) { foreach (var newClass in comparison.ClassesToAdd) { string userFilePath = Path.Combine(Path.GetDirectoryName(outputProjectPath), newClass.UserFileRelativePath); if (!File.Exists(userFilePath)) { this.CreateUserFile(newClass, userFilePath); } string designerFilePath = Path.Combine(Path.GetDirectoryName(outputProjectPath), newClass.DesignerFileRelativePath); //if (!File.Exists(designerFilePath)) //{ switch (newClass.SourceObjectType) { case EnumSourceObjectType.MasterPage: this.CreateDesignerMasterPageFile(newClass, designerFilePath); break; case EnumSourceObjectType.WebPage: this.CreateDesignerWebPageFile(newClass, designerFilePath); break; default: throw new UnknownEnumValueException(newClass.SourceObjectType); } //} ProjectParser parser = new ProjectParser(); parser.EnsureFileInclude(outputProjectPath, newClass.UserFileRelativePath, null); parser.EnsureFileInclude(outputProjectPath, newClass.DesignerFileRelativePath, newClass.UserFileRelativePath); } foreach (var updatedClass in comparison.ClassesToUpdate) { string designerFilePath = Path.Combine(Path.GetDirectoryName(outputProjectPath), updatedClass.DesignerFileRelativePath); //if (!File.Exists(designerFilePath)) //{ switch (updatedClass.SourceObjectType) { case EnumSourceObjectType.MasterPage: this.CreateDesignerMasterPageFile(updatedClass, designerFilePath); break; case EnumSourceObjectType.WebPage: this.CreateDesignerWebPageFile(updatedClass, designerFilePath); break; default: throw new UnknownEnumValueException(updatedClass.SourceObjectType); } //} ProjectParser parser = new ProjectParser(); parser.EnsureFileInclude(outputProjectPath, updatedClass.DesignerFileRelativePath, updatedClass.DesignerFileRelativePath); } }
public void ApplyChanges(TargetProjectComparisonResult comparison, string outputProjectPath) { foreach(var newClass in comparison.ClassesToAdd) { string userFilePath = Path.Combine(Path.GetDirectoryName(outputProjectPath), newClass.UserFileRelativePath); if (!File.Exists(userFilePath)) { this.CreateUserFile(newClass, userFilePath); } string designerFilePath = Path.Combine(Path.GetDirectoryName(outputProjectPath), newClass.DesignerFileRelativePath); //if (!File.Exists(designerFilePath)) //{ switch (newClass.SourceObjectType) { case EnumSourceObjectType.MasterPage: this.CreateDesignerMasterPageFile(newClass, designerFilePath); break; case EnumSourceObjectType.WebPage: this.CreateDesignerWebPageFile(newClass, designerFilePath); break; default: throw new UnknownEnumValueException(newClass.SourceObjectType); } //} ProjectParser parser = new ProjectParser(); parser.EnsureFileInclude(outputProjectPath, newClass.UserFileRelativePath, null); parser.EnsureFileInclude(outputProjectPath, newClass.DesignerFileRelativePath, newClass.UserFileRelativePath); } foreach(var updatedClass in comparison.ClassesToUpdate) { string designerFilePath = Path.Combine(Path.GetDirectoryName(outputProjectPath), updatedClass.DesignerFileRelativePath); //if (!File.Exists(designerFilePath)) //{ switch (updatedClass.SourceObjectType) { case EnumSourceObjectType.MasterPage: this.CreateDesignerMasterPageFile(updatedClass, designerFilePath); break; case EnumSourceObjectType.WebPage: this.CreateDesignerWebPageFile(updatedClass, designerFilePath); break; default: throw new UnknownEnumValueException(updatedClass.SourceObjectType); } //} ProjectParser parser = new ProjectParser(); parser.EnsureFileInclude(outputProjectPath, updatedClass.DesignerFileRelativePath, updatedClass.DesignerFileRelativePath); } }
public TargetProjectComparisonResult CompareProject(TargetProject targetProject, SourceWebProject sourceProject) { TargetProjectComparisonResult result = new TargetProjectComparisonResult(); //foreach (var masterPage in sourceProject.MasterPageList) //{ // //Find existing object // var targetClass = targetProject.TargetClassList.SingleOrDefault(i => i.SourceClassFullName == masterPage.ClassFullName); // if (targetClass == null) // { // TargetClassComparisonResult classResult = new TargetClassComparisonResult() // { // a // } // //If does not exist, create it // targetClass = TargetClass.Create(targetProject, sourceProject, masterPage); // result.ClassesToAdd.Add(targetClass); // } // targetClass.PageUrl = masterPage.PageUrl; // targetClass.TargetObjectType = EnumTargetObjectType.MasterPage; // this.TargetClassManager.UpdateTargetClass(masterPage, targetClass); //} foreach (var sourcePage in sourceProject.WebPageList) { var targetClass = targetProject.TargetClassList.SingleOrDefault(i => i.SourceClassFullName == sourcePage.ClassFullName); if (targetClass == null) { TargetClassComparisonResult classResult = this.CompareClass(sourceProject, sourcePage, targetProject, null); result.ClassesToAdd.Add(classResult); } else { TargetClassComparisonResult classResult = this.CompareClass(sourceProject, sourcePage, targetProject, targetClass); result.ClassesToUpdate.Add(classResult); } } return(result); }
public TargetProjectComparisonResult CompareProject(TargetProject targetProject, SourceWebProject sourceProject) { TargetProjectComparisonResult result = new TargetProjectComparisonResult(); //foreach (var masterPage in sourceProject.MasterPageList) //{ // //Find existing object // var targetClass = targetProject.TargetClassList.SingleOrDefault(i => i.SourceClassFullName == masterPage.ClassFullName); // if (targetClass == null) // { // TargetClassComparisonResult classResult = new TargetClassComparisonResult() // { // a // } // //If does not exist, create it // targetClass = TargetClass.Create(targetProject, sourceProject, masterPage); // result.ClassesToAdd.Add(targetClass); // } // targetClass.PageUrl = masterPage.PageUrl; // targetClass.TargetObjectType = EnumTargetObjectType.MasterPage; // this.TargetClassManager.UpdateTargetClass(masterPage, targetClass); //} foreach (var sourcePage in sourceProject.WebPageList) { var targetClass = targetProject.TargetClassList.SingleOrDefault(i => i.SourceClassFullName == sourcePage.ClassFullName); if (targetClass == null) { TargetClassComparisonResult classResult = this.CompareClass(sourceProject, sourcePage, targetProject, null); result.ClassesToAdd.Add(classResult); } else { TargetClassComparisonResult classResult = this.CompareClass(sourceProject, sourcePage, targetProject, targetClass); result.ClassesToUpdate.Add(classResult); } } return result; }
public void UpdateProjectFile(TargetProject targetProject, TargetProjectComparisonResult projectComparison) { foreach(var newClass in projectComparison.ClassesToAdd) { this.AddClass(targetProject, newClass); } foreach(var updateClass in projectComparison.ClassesToUpdate) { this.UpdateClass(targetProject, updateClass); } }