Exemple #1
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(AppDomain.CurrentDomain.BaseDirectory, 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());
        }
 public void Commit()
 {
     try
     {
         var filename = this.itemName + ".xml";
         using var stream = File.OpenWrite(filename);
         this.Write(stream, this.serializer);
     }
     catch (Exception e)
     {
         CremaLog.Error(e);
         throw;
     }
 }
 public RepositoryConfiguration(string itemName, IEnumerable <IConfigurationPropertyProvider> propertiesProvider)
     : base(typeof(IRepositoryConfiguration), propertiesProvider)
 {
     this.itemName = itemName;
     try
     {
         var filename = this.itemName + ".xml";
         if (File.Exists(filename) == true)
         {
             using var stream = File.OpenRead(filename);
             this.Read(stream, this.serializer);
         }
     }
     catch (Exception e)
     {
         CremaLog.Error(e);
     }
 }