예제 #1
0
    public ExternalType(string ns, string n, ExternalAssembly a)
    {
        type_namespace = ns;
        type_name      = n;

        assembly = a;
    }
예제 #2
0
        private Dictionary <string, ExternalAssembly> GetAssemblies()
        {
            Dictionary <string, ExternalAssembly> returnList = new Dictionary <string, ExternalAssembly>();
            XmlNodeList Asses = this.ConfigXML.SelectNodes("//Assemblies/Assembly");

            foreach (XmlNode ass in Asses)
            {
                ExternalAssembly tempAss = new ExternalAssembly();
                List <ExternalAssemblyObjectProperty> tempAssProps = new List <ExternalAssemblyObjectProperty>();
                tempAss.Name       = ass.Attributes["Name"].Value;
                tempAss.ObjectName = ass.Attributes["Object"].Value;
                tempAss.Path       = ass.Attributes["Path"].Value;

                XmlNodeList AssProperties = ass.SelectNodes("//Properties/Property");
                foreach (XmlNode prop in AssProperties)
                {
                    ExternalAssemblyObjectProperty assProp = new ExternalAssemblyObjectProperty();
                    assProp.Name  = prop["Name"].InnerText;
                    assProp.Type  = prop["Type"].InnerText;
                    assProp.Value = prop["Value"].InnerText;

                    tempAssProps.Add(assProp);
                }
                tempAss.Properties = tempAssProps;

                var asm = Assembly.LoadFile(tempAss.Path);
                tempAss.ObjectType = asm.GetType(tempAss.ObjectName);

                returnList.Add(tempAss.Name, tempAss);
            }
            return(returnList);
        }
예제 #3
0
 static public ExternalType CreateExternalType(TypeDefinition type, ExternalAssembly assembly)
 {
     return(new ExternalType(
                type.Namespace,
                type.Name,
                assembly
                ));
 }
예제 #4
0
 public void Create(string filepath)
 {
     types = Directory.GetFiles(filepath, "*.dll", SearchOption.AllDirectories)
             .Convert(p => ExternalAssembly.LoadExternalAssembly(p))
             .Convert(a => a.GetExternalTypes()).Flatten()
             .ConvertToValueOfPair(t => t.GetReference())
             .ToDictionaryOverwrite();
 }
예제 #5
0
        private void SetupAssembly(ExternalAssembly ea)
        {
            Log assemblyLog = new Log(LogType.Message, ea.Name);

            try
            {
                _dm.Assemblies.TryAdd(ea.Name, ea);
                assemblyLog.EndTime = DateTime.Now;
                assemblyLog.Message = "Assembly added successfully";
            }
            catch (Exception ex)
            {
                assemblyLog.Successful = false;
                assemblyLog.EndTime    = DateTime.Now;
                assemblyLog.Message    = "Assembly add failed - " + ex.Message;
            }


            Parallel.ForEach(observers, observer =>
            {
                observer.OnNext(assemblyLog);
            });
        }