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; }
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); }
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(); }
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); }
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)); }
private void setupWatchers(ApplicationSettings settings, ApplicationStartResponse response) { _watcher.StartWatching(settings, response.BottleDirectories); }
public IApplicationSource FindSource(ApplicationSettings settings, ApplicationStartResponse theResponse) { Type type = findType(settings, theResponse); return type == null ? null : (IApplicationSource)Activator.CreateInstance(type); }
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(); }
public IApplicationSource FindSource(ApplicationSettings settings, ApplicationStartResponse theResponse) { Type type = findType(settings, theResponse); return(type == null ? null : (IApplicationSource)Activator.CreateInstance(type)); }