예제 #1
0
		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);
			}
		}
예제 #2
0
		static void Main()
		{
			//string inputProject = @"C:\Users\admin\Dropbox\Code\screwturn-screwturn-wiki-4-cf9155b27d4c\WebApplication\WebApplication.csproj";
			string inputProjectPath = @"..\..\..\..\BugNet\src\BugNET_WAP\BugNET_WAP.csproj";
			//string outputProjectPath = @"C:\Users\admin\Dropbox\Code\MMDB.UITest\ScrewturnWikiProxySample\ScrewturnWikiProxySample.csproj";
			string outputProjectPath = @"..\..\..\BugNetProxySample\BugNetProxySample.csproj";
			var sourceProjectFile = new ProjectParser().ParseFile(inputProjectPath);
			var sourceModel = new SourceWebModelParser().LoadFromProjectFile(sourceProjectFile, inputProjectPath);

			var targetProjectFile = new ProjectParser().ParseFile(outputProjectPath);
			var targetModel = new TargetModelParser().LoadFromProjectFile(targetProjectFile, outputProjectPath);

			var comparison = new TargetModelGenerator().CompareProject(targetModel, sourceModel);
			new TargetModelWriter().ApplyChanges(comparison, outputProjectPath);

			//ProxyGenerator.UpdateProxyProject(outputProjectPath, sourceProject);
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			Application.Run(new Form1());

		}
예제 #3
0
        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);
		}
예제 #4
0
		public TargetProject LoadFromProjectFile(string targetProjectPath)
		{
			ProjectParser parser = new ProjectParser();
			var csProject = parser.ParseFile(targetProjectPath);
			return LoadFromProjectFile(csProject, targetProjectPath);
		}