Пример #1
0
        public CremaHost(CremaSettings settings, [ImportMany] IEnumerable <IRepositoryProvider> repoProviders)
        {
            CremaLog.Debug("crema instance created.");
            this.settings           = settings;
            this.basePath           = settings.BasePath;
            this.repositoryPath     = Path.Combine(settings.BasePath, settings.RepositoryName);
            this.trunkPath          = Path.Combine(this.repositoryPath, trunkString);
            this.tagsPath           = Path.Combine(this.repositoryPath, tagsString);
            this.branchesPath       = Path.Combine(this.repositoryPath, branchesString);
            this.workingPath        = Path.Combine(this.basePath, workingString);
            this.repositoryProvider = repoProviders.First(item => item.Name == this.settings.RepositoryModule);
            this.repositoryProvider.ValidateRepository(this.basePath, this.repositoryPath);

            this.log = new LogService(this.GetType().FullName, this.WorkingPath)
            {
                Name    = "repository",
                Verbose = settings.Verbose
            };
            CremaLog.Debug("crema log service initialized.");
            CremaLog.Debug($"available tags : {string.Join(", ", TagInfoUtility.Names)}");
            if (settings.MultiThreading == true)
            {
                this.dispatcher = new CremaDispatcher(this);
            }
            else
            {
                this.dispatcher = new CremaDispatcher(this, System.Windows.Threading.Dispatcher.CurrentDispatcher);
            }
            this.repositoryDispatcher = new CremaDispatcher(this.repositoryProvider);
            CremaLog.Debug("crema dispatcher initialized.");
        }
Пример #2
0
        public virtual IEnumerable <Assembly> GetAssemblies()
        {
            var assemblyList = new List <Assembly>();

            if (Assembly.GetEntryAssembly() != null)
            {
                assemblyList.Add(Assembly.GetEntryAssembly());
            }

            var query = from directory in EnumerableUtility.Friends(AssemblyDirectoryPath, this.SelectPath())
                        let catalog = new DirectoryCatalog(directory)
                                      from file in catalog.LoadedFiles
                                      select file;

            foreach (var item in query)
            {
                try
                {
                    var assembly = Assembly.LoadFrom(item);
                    assemblyList.Add(assembly);
                    CremaLog.Debug(assembly.Location);
                }
                catch
                {
                }
            }

            return(assemblyList.Distinct());
        }
Пример #3
0
 public async void RemoveService(ICremaService service)
 {
     if (this.services.Contains(service) == false)
     {
         return;
     }
     this.services.Remove(service);
     CremaLog.Debug($"{service.GetType().Name} Released.");
     if (this.services.Any() == false)
     {
         await this.dispatcher.InvokeAsync(() =>
         {
             this.InvokeClose(this.closeInfo);
         });
     }
 }
Пример #4
0
 public CremaHost()
 {
     this.dispatcher = new CremaDispatcher(this);
     CremaLog.Debug($"available tags : {string.Join(",", TagInfoUtility.Names)}");
     CremaLog.Debug("Crema created.");
 }
Пример #5
0
 public void AddService(ICremaService service)
 {
     this.services.Add(service);
     CremaLog.Debug($"{service.GetType().Name} Initialized.");
 }
Пример #6
0
 public CremaBootstrapper()
 {
     this.Initialize();
     this.settings.RepositoryModule = DefaultRepositoryModule;
     CremaLog.Debug("default repository module : {0}", this.settings.RepositoryModule);
 }
Пример #7
0
 private void Initialize()
 {
     CremaLog.Debug("Initialize.");
     this.OnInitialize();
     CremaLog.Debug("Initialized.");
 }