public Project GetProject()
		{
			//Project project = FluorineContext.Current.Session[FluorineProjectSessionKey] as Project;
			Project project = HttpContext.Current.Application[FluorineProjectSessionKey] as Project;
			if( project == null )
			{
				string[] lac = TypeHelper.GetLacLocations();

                project = new Project(FluorineContext.Current.ApplicationPath, FluorineContext.Current.AbsoluteUri, HttpContext.Current.Server.MapPath(FluorineContext.Current.RequestApplicationPath), /*FluorineContext.Current.RequestApplicationPath,*/ lac);
                Type[] excludeTypes = new Type[] { typeof(System.Web.UI.Page), typeof(System.Web.HttpApplication) };
                Type[] attributes = new Type[] { typeof(FluorineFx.RemotingServiceAttribute), typeof(FluorineFx.TransferObjectAttribute) };
                project.Build(excludeTypes, attributes, false);
                
                string safeName = Management.Util.GetSafeString(FluorineContext.Current.RequestApplicationPath);
				project.Package = safeName;
                //If we have assemblies pick up the first namespace as the package
                foreach (AssemblyDescriptor assemblyDescriptor in project.Assemblies)
                {
                    if( assemblyDescriptor.Namespaces.Count > 0 )
                        project.Package = assemblyDescriptor.Namespaces[0].Name;
                }
				project.Name = safeName;
				project.ContextRoot = FluorineContext.Current.RequestApplicationPath;
				project.Locked = true;

                string baseDirectory = Path.Combine(FluorineContext.Current.ApplicationBaseDirectory, "apps");
                if (Directory.Exists(baseDirectory))
                {
                    foreach (string appDirectory in Directory.GetDirectories(baseDirectory))
                    {
                        DirectoryInfo directoryInfo = new DirectoryInfo(appDirectory);
                        string appName = directoryInfo.Name;
                        string appConfigFile = Path.Combine(appDirectory, "app.config");
                        ApplicationConfiguration configuration = ApplicationConfiguration.Load(appConfigFile);

                        Application application = new Application();
                        application.Name = appName;
                        application.Directory = directoryInfo.Name;
                        application.ApplicationHandler = configuration.ApplicationHandler.Type;

                        project.AddApplication(application);
                    }
                }
				//FluorineContext.Current.Session[FluorineProjectSessionKey] = project;
				HttpContext.Current.Application.Add(FluorineProjectSessionKey, project); 
			}
			return project;
		}
Example #2
0
 public void AddApplication(Application application)
 {
     if (!Contains(application))
     {
         _applications = ArrayUtils.Resize(_applications, _applications.Length + 1) as Application[];
         _applications[_applications.Length - 1] = application;
     }
 }
        public void RefreshProject()
        {
            Project project = HttpContext.Current.Application[FluorineProjectSessionKey] as Project;
            if (project != null)
            {
                string[] lac = TypeHelper.GetLacLocations();

                project.ApplicationUrl = FluorineContext.Current.ApplicationPath;
                project.Url = FluorineContext.Current.AbsoluteUri;
                project.ApplicationRoot = HttpContext.Current.Server.MapPath(FluorineContext.Current.RequestApplicationPath);
                project.AssemblyPaths = lac;
                Type[] excludeTypes = new Type[] { typeof(System.Web.UI.Page), typeof(System.Web.HttpApplication) };
                Type[] attributes = new Type[] { typeof(FluorineFx.RemotingServiceAttribute), typeof(FluorineFx.TransferObjectAttribute) };
                project.Build(excludeTypes, attributes, false);

                project.ContextRoot = FluorineContext.Current.RequestApplicationPath;

                project.ClearApplications();
                string baseDirectory = Path.Combine(FluorineContext.Current.ApplicationBaseDirectory, "apps");
                if (Directory.Exists(baseDirectory))
                {
                    foreach (string appDirectory in Directory.GetDirectories(baseDirectory))
                    {
                        DirectoryInfo directoryInfo = new DirectoryInfo(appDirectory);
                        string appName = directoryInfo.Name;
                        string appConfigFile = Path.Combine(appDirectory, "app.config");
                        ApplicationConfiguration configuration = ApplicationConfiguration.Load(appConfigFile);

                        Application application = new Application();
                        application.Name = appName;
                        application.Directory = directoryInfo.Name;
                        application.ApplicationHandler = configuration.ApplicationHandler.Type;

                        project.AddApplication(application);
                    }
                }
            }
        }
Example #4
0
 public bool Contains(Application application)
 {
     foreach (Application applicationTmp in _applications)
     {
         if (applicationTmp.Name == application.Name)
             return true;
     }
     return false;
 }