Esempio n. 1
0
        public ApplicationStartResponse StartApplication(ApplicationSettings settings, ManualResetEvent reset)
        {
            var response = new ApplicationStartResponse();

            try
            {
                var source = _sourceFinder.FindSource(settings, response);
                if (source == null)
                {
                    response.Status = ApplicationStartStatus.CouldNotResolveApplicationSource;
                }
                else
                {
                    StartApplication(source, settings, reset);
                    response.ApplicationSourceName = source.GetType().AssemblyQualifiedName;

                    reset.WaitOne();
                    determineBottleFolders(response);
                }
            }
            catch (Exception ex)
            {
                response.ErrorMessage = ex.ToString();
                response.Status = ApplicationStartStatus.ApplicationSourceFailure;
            }

            return response;
        }
Esempio n. 2
0
        public ApplicationStartResponse StartApplication(ApplicationSettings settings, ManualResetEvent reset)
        {
            var response = new ApplicationStartResponse();

            try
            {
                var source = _sourceFinder.FindSource(settings, response);
                if (source == null)
                {
                    response.Status = ApplicationStartStatus.CouldNotResolveApplicationSource;
                }
                else
                {
                    StartApplication(source, settings, reset);
                    response.ApplicationSourceName = source.GetType().AssemblyQualifiedName;

                    reset.WaitOne();
                    determineBottleFolders(response);
                }
            }
            catch (Exception ex)
            {
                response.ErrorMessage = ex.ToString();
                response.Status       = ApplicationStartStatus.ApplicationSourceFailure;
            }

            return(response);
        }
Esempio n. 3
0
        private static void determineBottleFolders(ApplicationStartResponse response)
        {
            var list = new List <string>();

            PackageRegistry.Packages.Each(pak =>
            {
                pak.ForFolder(BottleFiles.WebContentFolder, list.Add);
                pak.ForFolder(BottleFiles.BinaryFolder, list.Add);
                pak.ForFolder(BottleFiles.DataFolder, list.Add);
            });

            response.BottleDirectories = list.ToArray();
        }
Esempio n. 4
0
        private Type findType(ApplicationSettings settings, ApplicationStartResponse theResponse)
        {
            if (settings.ApplicationSourceName.IsNotEmpty())
            {
                return Type.GetType(settings.ApplicationSourceName);
            }

            var types = _typeFinder.FindApplicationSourceTypes();
            theResponse.ApplicationSourceTypes = types.Select(x => x.AssemblyQualifiedName).ToArray();

            if (!types.Any()) return null;

            return only(types) ?? matchingTypeName(settings, types);
        }
Esempio n. 5
0
        private Type findType(ApplicationSettings settings, ApplicationStartResponse theResponse)
        {
            if (settings.ApplicationSourceName.IsNotEmpty())
            {
                return(Type.GetType(settings.ApplicationSourceName));
            }

            var types = _typeFinder.FindApplicationSourceTypes();

            theResponse.ApplicationSourceTypes = types.Select(x => x.AssemblyQualifiedName).ToArray();

            if (!types.Any())
            {
                return(null);
            }

            return(only(types) ?? matchingTypeName(settings, types));
        }
Esempio n. 6
0
 private void setupWatchers(ApplicationSettings settings, ApplicationStartResponse response)
 {
     _watcher.StartWatching(settings, response.BottleDirectories);
 }
Esempio n. 7
0
 public IApplicationSource FindSource(ApplicationSettings settings, ApplicationStartResponse theResponse)
 {
     Type type = findType(settings, theResponse);
     return type == null ? null : (IApplicationSource)Activator.CreateInstance(type);
 }
Esempio n. 8
0
        private static void determineBottleFolders(ApplicationStartResponse response)
        {
            var list = new List<string>();
            PackageRegistry.Packages.Each(pak =>
            {
                pak.ForFolder(BottleFiles.WebContentFolder, list.Add);
                pak.ForFolder(BottleFiles.BinaryFolder, list.Add);
                pak.ForFolder(BottleFiles.DataFolder, list.Add);
            });

            response.BottleDirectories = list.ToArray();
        }
Esempio n. 9
0
        public IApplicationSource FindSource(ApplicationSettings settings, ApplicationStartResponse theResponse)
        {
            Type type = findType(settings, theResponse);

            return(type == null ? null : (IApplicationSource)Activator.CreateInstance(type));
        }