コード例 #1
0
ファイル: ArtefactsDepot.cs プロジェクト: alejandraa/TaskMQ
        /// <summary>
        /// This check for conflicts between all modules references <br/>
        ///     this thing about that you don't have isolation to make sure all modules are up to date
        /// </summary>
        /// <param name="binPackage"></param>
        public void RegisterAssets(AssemblyVersionPackage binPackage)
        {
            for (int i = 0; i < binPackage.Version.Artefacts.Count; i++)
            {
                AssemblyArtifact art = binPackage.Version.Artefacts[i];
                if (art.IsAssembly)
                {
                    if (AssemblyControlList.ContainsKey(art.Name))
                    {
                        if (AssemblyControlList[art.Name].art.Version != art.Version)
                            throw new Exception(string.Format("The module {0} has incosistent dependency '{1}'({2}) with other modules - '{3}'({4}): {5}",
                                binPackage.ContainerName, art.Name, art.Version,
                                AssemblyControlList[art.Name].art.Name, AssemblyControlList[art.Name].art.Version,
                                AssemblyControlList[art.Name].IsLocalDependency ? "WorkingDir Dependency" : "Module dependency"));
                    }
                    else
                    {
                        PackageAndArtefactLibLinked l = new PackageAndArtefactLibLinked
                        {
                            art = art,
                            pckg = binPackage
                        };

                        AssemblyControlList.Add(art.Name, l);
                    }
                }
            }
        }
コード例 #2
0
        public AssemblyVersionPackage GetLatestVersion()
        {
            Ref.AssemblyPackage pinfo = PackageInfo;
            if (pinfo == null)
            {
                Console.WriteLine("packageInfo absent in package {0}", this.Path);
                return(null);
            }

            Ref.AssemblyArtifacts  pv   = pinfo.FindLatestVersion();
            AssemblyVersionPackage pckg = new AssemblyVersionPackage(pv, this);

            return(pckg);
        }
コード例 #3
0
ファイル: AssemblyModule.cs プロジェクト: alejandraa/TaskMQ
 public AssemblyModule(AssemblyVersionPackage package)
 {
     this.package = package;
 }
コード例 #4
0
ファイル: AssemblyVersions.cs プロジェクト: alejandraa/TaskMQ
        public AssemblyVersionPackage GetLatestVersion()
        {
            Ref.AssemblyPackage pinfo = PackageInfo;
            if (pinfo == null)
            {
                Console.WriteLine("packageInfo absent in package {0}", this.Path);
                return null;
            }

            Ref.AssemblyArtifacts pv = pinfo.FindLatestVersion();
            AssemblyVersionPackage pckg = new AssemblyVersionPackage(pv, this);
            return pckg;
        }
コード例 #5
0
ファイル: Assemblys.cs プロジェクト: alejandraa/TaskMQ
 private bool LoadAssembly(Broker b, AssemblyVersionPackage a, out string remarks)
 {
     remarks = string.Empty;
     try
     {
         SharedManagedLibraries.RegisterAssets(a);
         AddAssemblyUnsafe(b, a);
     }
     catch (Exception e)
     {
         remarks = string.Format("assembly loading error: '{0}' :: {1} :: {2}", a.ContainerName, e.Message, e.StackTrace);
         logger.Exception(e, "load assembly", "error loading assembly package ContainerName: {0}", a.ContainerName);
         return false;
     }
     return true;
 }
コード例 #6
0
ファイル: Assemblys.cs プロジェクト: alejandraa/TaskMQ
        private void AddAssemblyUnsafe(Broker b, AssemblyVersionPackage a)
        {
            Assembly assembly = null;
            if (a.Version.FileSymbols != null)
                assembly = Assembly.Load(a.ExtractLibrary(), a.ExtractLibrarySymbols());
            else assembly = Assembly.Load(a.ExtractLibrary());

            string assemblyName = assembly.GetName().Name;
            AssemblyCard card = new AssemblyCard()
            {
                assembly = assembly,
                AssemblyName = assemblyName
            };
            var type = typeof(IMod);
            var types = assembly.GetTypes().Where(p => type.IsAssignableFrom(p) && !p.IsInterface);

            foreach (Type item in types)
            {
                b.Modules.RegisterInterface(item, assemblyName);
                b.RegisterSelfValuedModule(item);
            }
            card.Interfaces = (from t in types
                               select t.FullName).ToArray();

            loadedAssemblys.Add(assemblyName, card);
        }