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 EnsureFiles(string targetProjectPath) { string userFilePath = Path.Combine(Path.GetDirectoryName(targetProjectPath), this.UserFileRelativePath); if (!File.Exists(userFilePath)) { this.CreateUserFile(userFilePath); } string designerFilePath = Path.Combine(Path.GetDirectoryName(targetProjectPath), this.DesignerFileRelativePath); if (!File.Exists(designerFilePath)) { switch(this.SourceObjectType) { case EnumSourceObjectType.MasterPage: this.CreateDesignerMasterPageFile(designerFilePath); break; case EnumSourceObjectType.WebPage: this.CreateWebPageFile(designerFilePath); break; default: throw new UnknownEnumValueException(this.SourceObjectType); } } ProjectParser parser = new ProjectParser(); parser.EnsureFileInclude(targetProjectPath, this.UserFileRelativePath, null); parser.EnsureFileInclude(targetProjectPath, this.DesignerFileRelativePath, this.UserFileRelativePath); }