コード例 #1
0
        public SourceWebProject LoadFromProjectFile(CSProjectFile csProject, string projectFilePath)
        {
            SourceWebProject returnValue = new SourceWebProject()
            {
                RootNamespace = csProject.RootNamespace
            };
            var webPageList = csProject.WebFormContainers.Where(i => i.ContainerType == EnumWebFormContainerType.WebPage);

            foreach (var webPage in webPageList)
            {
                var csClass = csProject.ClassList.SingleOrDefault(i => i.ClassFullName == webPage.ClassFullName);
                if (csClass != null)
                {
                    SourceWebPage sourceWebPage = new SourceWebPage()
                    {
                        ClassFullName = webPage.ClassFullName,
                        PageUrl       = ConvertToUrl(webPage.FilePath, projectFilePath),
                        Controls      = LoadControls(webPage, csClass)
                    };
                    returnValue.WebPageList.Add(sourceWebPage);
                }
            }
            var masterPageList = csProject.WebFormContainers.Where(i => i.ContainerType == EnumWebFormContainerType.MasterPage);

            foreach (var masterPage in masterPageList)
            {
                SourceMasterPage sourceMasterPage = new SourceMasterPage()
                {
                    ClassFullName = masterPage.ClassFullName,
                    PageUrl       = ConvertToUrl(masterPage.FilePath, projectFilePath)
                };
                returnValue.MasterPageList.Add(sourceMasterPage);
            }
            var userControlList = csProject.WebFormContainers.Where(i => i.ContainerType == EnumWebFormContainerType.UserControl);

            foreach (var userControl in userControlList)
            {
                var csClass = csProject.ClassList.SingleOrDefault(i => i.ClassFullName == userControl.ClassFullName);
                SourceUserControl sourceUserControl = new SourceUserControl()
                {
                    ClassFullName = userControl.ClassFullName,
                    Controls      = LoadControls(userControl, csClass)
                };
                returnValue.UserControlList.Add(sourceUserControl);
            }
            return(returnValue);
        }
コード例 #2
0
		public SourceWebProject LoadFromProjectFile(CSProjectFile csProject, string projectFilePath)
		{
			SourceWebProject returnValue = new SourceWebProject()
			{
				RootNamespace = csProject.RootNamespace
			};
			var webPageList = csProject.WebFormContainers.Where(i => i.ContainerType == EnumWebFormContainerType.WebPage);
			foreach (var webPage in webPageList)
			{
				var csClass = csProject.ClassList.SingleOrDefault(i => i.ClassFullName == webPage.ClassFullName);
				if (csClass != null)
				{
					SourceWebPage sourceWebPage = new SourceWebPage()
					{
						ClassFullName = webPage.ClassFullName,
						PageUrl = ConvertToUrl(webPage.FilePath, projectFilePath),
						Controls = LoadControls(webPage, csClass)
					};
					returnValue.WebPageList.Add(sourceWebPage);
				}
			}
			var masterPageList = csProject.WebFormContainers.Where(i => i.ContainerType == EnumWebFormContainerType.MasterPage);
			foreach (var masterPage in masterPageList)
			{
				SourceMasterPage sourceMasterPage = new SourceMasterPage()
				{
					ClassFullName = masterPage.ClassFullName,
					PageUrl = ConvertToUrl(masterPage.FilePath, projectFilePath)
				};
				returnValue.MasterPageList.Add(sourceMasterPage);
			}
			var userControlList = csProject.WebFormContainers.Where(i => i.ContainerType == EnumWebFormContainerType.UserControl);
			foreach (var userControl in userControlList)
			{
				var csClass = csProject.ClassList.SingleOrDefault(i => i.ClassFullName == userControl.ClassFullName);
				SourceUserControl sourceUserControl = new SourceUserControl()
				{
					ClassFullName = userControl.ClassFullName,
					Controls = LoadControls(userControl, csClass)
				};
				returnValue.UserControlList.Add(sourceUserControl);
			}
			return returnValue;
		}