internal static void AddComponent(string filePath, string assemblyName, string typeName, string progId, string assemblyFile, string wkoMode, bool wellKnown, bool clientActivated) { try { AssemblyManager manager = new AssemblyManager(); string str = typeName + ", " + manager.GetFullName(assemblyFile); string str2 = typeName + ", " + assemblyName; XmlDocument configXml = new XmlDocument(); configXml.Load(filePath); XmlNode documentElement = configXml.DocumentElement; documentElement = FindOrCreateElement(configXml, documentElement, "system.runtime.remoting"); documentElement = FindOrCreateElement(configXml, documentElement, "application"); documentElement = FindOrCreateElement(configXml, documentElement, "service"); XmlNodeList list = documentElement.SelectNodes("descendant::*[attribute::type='" + str2 + "']"); while ((list != null) && (list.Count > 0)) { XmlNode oldChild = list.Item(0); if (oldChild.ParentNode != null) { oldChild.ParentNode.RemoveChild(oldChild); list = documentElement.SelectNodes("descendant::*[attribute::type='" + str2 + "']"); } } list = documentElement.SelectNodes("descendant::*[attribute::type='" + str + "']"); while ((list != null) && (list.Count > 0)) { XmlNode node3 = list.Item(0); if (node3.ParentNode != null) { node3.ParentNode.RemoveChild(node3); list = documentElement.SelectNodes("descendant::*[attribute::type='" + str + "']"); } } if (wellKnown) { XmlElement newChild = configXml.CreateElement("wellknown"); newChild.SetAttribute("mode", wkoMode); newChild.SetAttribute("type", str); newChild.SetAttribute("objectUri", progId + ".soap"); documentElement.AppendChild(newChild); } if (clientActivated) { XmlElement element2 = configXml.CreateElement("activated"); element2.SetAttribute("type", str2); documentElement.AppendChild(element2); } configXml.Save(filePath); } catch (Exception exception) { if ((exception is NullReferenceException) || (exception is SEHException)) { throw; } ComSoapPublishError.Report(Resource.FormatString("Soap_ConfigAdditionFailure") + " " + exception.Message); throw; } }
void client_DeleteExtensionLibraryCompleted(object sender, ApplicationBuilder.DeleteExtensionLibraryCompletedEventArgs e) { if (e.Cancelled) { return; } if (e.Error != null) { return; } Extension extension = e.UserState as Extension; if (extension != null) { BuilderApplication.Instance.AllExtensions.Remove(extension); } // Check if the assembly is not part of any remaining extension // If not present, then delete it from the AssemblyManager's cache if (extension.Assemblies != null) { // Check each of the assemblies within the extension beind deleted foreach (ESRI.ArcGIS.Mapping.Builder.Common.Assembly assembly in extension.Assemblies) { // Check if it exists among other extensions bool exists = false; foreach (Extension ex in BuilderApplication.Instance.AllExtensions) { if (ex.Assemblies == null) { continue; } if (ex.Assemblies.FirstOrDefault <ESRI.ArcGIS.Mapping.Builder.Common.Assembly>(a => a.Name == assembly.Name) != null) { exists = true; break; } } if (!exists) { AssemblyManager.DeleteAssembly(AssemblyManager.GetAssemblyByName(assembly.Name)); } } } ExtensionsListVisiblity = BuilderApplication.Instance.AllExtensions.Count > 0 ? Visibility.Visible : Visibility.Collapsed; OnExtensionsCatalogChanged(EventArgs.Empty); }
internal void SetAssembly(string assemblyName) { if (string.IsNullOrWhiteSpace(assemblyName)) { return; } //首先从当前应用域中查看是否有已加载的程序集名称与指定的程序集名相同,如果将当前插件的程序集引用指向它即可 foreach (var assembly in AssemblyManager.GetAssemblyNames()) { if (string.Equals(assembly.Name, assemblyName, StringComparison.OrdinalIgnoreCase)) { _assemblies.Add(Assembly.Load(assembly)); return; } } string filePath = assemblyName; if (!Path.IsPathRooted(assemblyName)) { string directoryName = Path.GetDirectoryName(_plugin.FilePath); filePath = Path.Combine(directoryName, assemblyName); } if ((!filePath.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)) && (!filePath.EndsWith(".exe", StringComparison.OrdinalIgnoreCase))) { filePath = filePath + ".dll"; if (!File.Exists(filePath)) { filePath = filePath + ".exe"; } } if (!File.Exists(filePath)) { throw new PluginException(1, string.Format("The '{0}' assembly file is not exists. in '{1}' plugin file.", assemblyName, _plugin.FilePath)); } Assembly result = AssemblyManager.LoadFrom(filePath); if (result != null) { _assemblies.Add(result); } }
public App() : base() { // Add the styles from this page to the application - overrides styles from VertiGIS.Mobile var res = new Styles().Resources; this.Resources.MergedDictionaries.Add(res); MainPage = new ContentPage() { Content = GetContent() }; // Register additional assemblies to search for configured assembly attributes. AssemblyManager.RegisterAssemblies(this.GetType().Assembly); }
public void Execute_ExistingType_StaticMethod() { //Build the SUT var am = new AssemblyManager(); var paramDico = new Dictionary <string, object>() { { "paramString", "MyString" } }; //Call the method to test var actual = am.ExecuteStatic(typeof(Resource.StaticKlass), "ExecuteStaticString", paramDico); //Assertion Assert.That(actual, Is.EqualTo("Executed")); }
public AttachmentPool(ParameterCollection[] attachments) { if (attachments.Length > 0) { for (int i = 0; i < attachments.Length; i++) { object obj = AssemblyManager.CreateInstance(attachments[i]); if (obj != null) { Attach(obj as IAttachment); } } } }
private static String Decompile(String method) { IMethodReference methodReference = AssemblyManager.FindMethod(typeof(PostIncrementTest).GetMethod(method, BindingFlags.NonPublic | BindingFlags.Static)); Assert.IsNotNull(methodReference); StringBuilder result = new StringBuilder(); foreach (IStatement statement in methodReference.Resolve().Body.Statements) { result.Append(TestUtils.WriteStatement(statement)); } return(result.ToString()); }
public ActionResult ProxyTest() { Dictionary <string, string> requestParams = new Dictionary <string, string>() { { "InputParam1", "input test 1" }, { "InputParam2", "input test 2" }, }; AssemblyProxyManager proxyManager = new AssemblyProxyManager(); AssemblyManager assembliesManager = proxyManager.CreateInstance($"{PluginsWorkDirectory}\\Implement\\Operation.Factory.Implement.dll", "Operation.Factory.Implement.UmsPublishFeedOperation"); OperationExecuteResponse response = assembliesManager.Execute(requestParams); string outputs = JsonConvert.SerializeObject(response); proxyManager.UnloadInstance(); return(Content(outputs)); }
public void Execute_ExistingTypeConstructoreWithZeroParam_PrivateMethodOneParameter() { //Build the SUT var am = new AssemblyManager(); var klass = new NBi.Testing.Unit.Core.Assemblies.Resource.Klass(); var paramDico = new Dictionary <string, object>(); paramDico.Add("paramString", "MyString"); //Call the method to test var actual = am.Execute(klass, "ExecutePrivateString", paramDico); //Assertion Assert.That(actual, Is.EqualTo("Executed")); }
public void Execute_ExistingType_StaticMethod() { //Build the SUT var am = new AssemblyManager(); var paramDico = new Dictionary <string, object>(); //Reverse param order to ensure they are correctly re-ordered! paramDico.Add("paramString", "MyString"); //Call the method to test var actual = am.ExecuteStatic(typeof(NBi.Testing.Unit.Core.Assemblies.Resource.StaticKlass), "ExecuteStaticString", paramDico); //Assertion Assert.That(actual, Is.EqualTo("Executed")); }
public void Load(string filePath) { ReaderParameters parameters = new ReaderParameters(ReadingMode.Deferred) { InMemory = false, ReadWrite = false, AssemblyResolver = this, }; AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(filePath, parameters); string fileName = Path.GetFileNameWithoutExtension(filePath); string assemblyName = AssemblyManager.ToAssemblyName(assembly.Name.Name); m_assemblies.Add(fileName, assembly); m_assemblies[assemblyName] = assembly; }
void SaveModel(string filepath) { List <Type> extraTypes = new List <Type>(); extraTypes.Add(typeof(EonDictionary <string, Shader>)); extraTypes.Add(typeof(EonDictionary <int, LODModelInfo>)); for (int i = 0; i < materials.Count; i++) { extraTypes.Add(AssemblyManager.GetType( materials.Values[i], materials.Keys[i])); } SerializationHelper.Serialize <ModelInfo>(shaders, filepath, extraTypes.ToArray()); }
public void EditorLoad() { List <Type> allTypes = new List <Type>(); var ilrConfig = ConfigBase.Load <FrameworkRuntimeConfig>().ILRConfig; if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.OSXEditor) { var ilrAsm = AssemblyManager.GetAssembly(ilrConfig.DllName); allTypes.AddRange(ilrAsm.DefinedTypes); } foreach (var type in allTypes) { CheckType(type); } }
private (IDocumentationLinker doc, CsSolution solution) ExecuteMappings(CppModule group, ConfigFile consumerConfig) { var docLinker = new DocumentationLinker(); var typeRegistry = new TypeRegistry(Logger, docLinker); var namingRules = new NamingRulesManager(); var assemblyManager = new AssemblyManager(); // Run the main mapping process var transformer = new TransformManager( GlobalNamespace, namingRules, Logger, typeRegistry, docLinker, new ConstantManager(namingRules, docLinker), assemblyManager) { ForceGenerator = _isAssemblyNew }; var(solution, defines) = transformer.Transform(group, Config, IntermediateOutputPath); consumerConfig.Extension = new List <ExtensionBaseRule>(defines); var(bindings, generatedDefines) = transformer.GenerateTypeBindingsForConsumers(); consumerConfig.Bindings.AddRange(bindings); consumerConfig.Extension.AddRange(generatedDefines); consumerConfig.Mappings.AddRange( docLinker.GetAllDocLinks().Select( link => new MappingRule { DocItem = link.cppName, MappingNameFinal = link.cSharpName })); if (Logger.HasErrors) { Logger.Fatal("Executing mapping rules failed"); } PrintStatistics(assemblyManager); DumpRenames(transformer); return(docLinker, solution); }
public IMethodReference FindMethod(uint metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) { // Lookup the type in the cache List <GenericReference <IMethodReference> > genericMethodReferences; if (_genericTokenMethodMap.TryGetValue(metadataToken, out genericMethodReferences)) { foreach (GenericReference <IMethodReference> r in genericMethodReferences) { if (CompareArrays(r.GenericArgs, genericMethodArguments)) { return(r.Reference); } } } IList <ITypeReference> genericArguments = new List <ITypeReference>(); foreach (Type type in genericTypeArguments) { genericArguments.Add(AssemblyManager.FindType(type, type.GetGenericArguments())); } MethodBase methodBase = _netModule.ResolveMethod((int)metadataToken, genericTypeArguments, genericMethodArguments); IMethodDeclaration methodDeclaration; if (methodBase is ConstructorInfo) { methodDeclaration = new ConstructorDeclaration((ConstructorInfo)methodBase, this, AssemblyManager.FindType(methodBase.DeclaringType, methodBase.DeclaringType.GetGenericArguments())); } else { methodDeclaration = new MethodDeclaration((MethodInfo)methodBase, this, AssemblyManager.FindType(methodBase.DeclaringType, methodBase.DeclaringType.GetGenericArguments())); } if (genericMethodReferences == null) { genericMethodReferences = new List <GenericReference <IMethodReference> >(); _genericTokenMethodMap.Add(metadataToken, genericMethodReferences); } genericMethodReferences.Add(new GenericReference <IMethodReference>(methodDeclaration, genericTypeArguments)); return(methodDeclaration); }
/// <summary> /// check validations of public types /// </summary> public void PublicTypesReview() { StringBuilder builder = new StringBuilder(); PascalCodeTypeReviewer pascalCodeTypeReviewer = new PascalCodeTypeReviewer(); foreach (var type in AssemblyManager.GetPublicTypes()) { pascalCodeTypeReviewer.Review(type, builder); } if (builder.Length > 0) { throw new Exception(builder.ToString()); } }
/// <summary> /// check validations of public properties /// </summary> public void PublicMethodsOfClassesReview() { StringBuilder builder = new StringBuilder(); PascalCodeMethodReviewer pascalCodePropertyReviewer = new PascalCodeMethodReviewer(); foreach (MethodInfo publicMethod in AssemblyManager.GetMethodsOfProperties()) { pascalCodePropertyReviewer.Review(publicMethod, builder); } if (builder.Length > 0) { throw new Exception(builder.ToString()); } }
public YahurrBot() { client = new DiscordSocketClient(); PermissionManager = new PermissionManager(this, client); LoggingManager = new LoggingManager(this, client); CommandManager = new CommandManager(this, client); ModuleManager = new ModuleManager(this, client); EventManager = new EventManager(this, client); FileManager = new FileManager(this, client); AssemblyManager = new AssemblyManager(this, client); LoggingManager.Log += Log; LoggingManager.Read += GetInput; AppDomain.CurrentDomain.ProcessExit += async(a, b) => await StopAsync().ConfigureAwait(false); }
static void ProcessAssembly(List <string> assemblies, string rootPath) { for (int i = 0; i < assemblies.Count; i++) { if (!assemblies[i].Contains("Eon.")) { if (!coppiedDlls.Contains(assemblies[i])) { File.Copy(rootPath + "Libraries\\" + assemblies[i], assemblies[i]); coppiedDlls.Add(assemblies[i]); AssemblyManager.AddAssemblyRef(assemblies[i]); } } } }
public void Read(Stream stream, string fileName) { ReaderParameters parameters = new ReaderParameters(ReadingMode.Immediate) { InMemory = true, ReadWrite = false, AssemblyResolver = this, }; AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(stream, parameters); fileName = Path.GetFileNameWithoutExtension(fileName); string assemblyName = AssemblyManager.ToAssemblyName(assembly.Name.Name); m_assemblies.Add(fileName, assembly); m_assemblies[assemblyName] = assembly; }
private void buildListOfAvailableBehaviors() { AssemblyManager.AddAssembly(typeof(ESRI.ArcGIS.Mapping.Controls.ConstrainExtentBehavior).Assembly); MapBehaviors.Clear(); IEnumerable<Type> exportedBehaviors = AssemblyManager.GetExportsForType(typeof(Behavior<Map>)); if (exportedBehaviors != null) { foreach (Type type in exportedBehaviors) { Behavior<Map> behavior = Activator.CreateInstance(type) as Behavior<Map>; if (behavior != null) MapBehaviors.Add(behavior); } } }
/// <summary> /// check custom type code reviewer /// </summary> public void CheckCustomTypePrefixNamingCodeReviewer() { StringBuilder builder = new StringBuilder(); foreach (CustomTypeSuffixAndPrefixNamingCodeReviewer reviewer in CustomCodeReviewerManager.CustomCodeReviewer.Where(x => x is CustomTypeSuffixAndPrefixNamingCodeReviewer reviewer && !reviewer.IsSuffix)) { foreach (Type type in AssemblyManager.GetPublicTypes()) { reviewer.Review(type, builder); } } if (builder.Length > 0) { throw new Exception(builder.ToString()); } }
public void MarkupInterfaceReview() { StringBuilder builder = new StringBuilder(); MarkupInterfaceReviewer pascalCodePropertyReviewer = new MarkupInterfaceReviewer(); foreach (Type type in AssemblyManager.GetPublicTypes()) { pascalCodePropertyReviewer.Review(type, builder); } if (builder.Length > 0) { throw new Exception(builder.ToString()); } }
public bool Deobfuscate(AssemblyManager assemblyManager) { PosibleModules(); var module = assemblyManager.Module; if (!IsPacked(module)) { return(false); } var resources = module.Resources; var newEntryPoint = ResolveEntryPoint(assemblyManager.Module); if (newEntryPoint == 0) { Logger.Exception( new Exception( "Error searching entry point token, maybe the file is protected.\nOpen the NoFuserEx.exe without arguments for see all help.")); } ModifyMethod(module.EntryPoint); using (var stream = new MemoryStream()) { module.Write(stream, new ModuleWriterOptions { Logger = DummyLogger.NoThrowInstance }); var asm = Assembly.Load(stream.ToArray()); var method = asm.ManifestModule.ResolveMethod(module.EntryPoint.MDToken.ToInt32()); var moduleDecrypted = (byte[])method.Invoke(null, new object[1]); assemblyManager.Module = ModuleDefMD.Load(moduleDecrypted); Logger.Verbose($"Module decrypted: {assemblyManager.Module.Name}."); } Logger.Verbose("Adding resources to new module..."); foreach (var resource in resources) { assemblyManager.Module.Resources.Add(resource); Logger.VeryVerbose($"Resource \"{resource.Name}\" added to new module."); } Logger.Verbose("Setting new entry point..."); assemblyManager.Module.EntryPoint = assemblyManager.Module.ResolveMethod(new MDToken(newEntryPoint).Rid); return(true); }
public App() { bool createdNew = true; mutex = new Mutex(true, "Dashboard", out createdNew); if (createdNew) { if (Environment.GetCommandLineArgs().Length > 1) { foreach (string arg in Environment.GetCommandLineArgs()) { if (string.Compare(arg, "Operator", true) == 0 || string.Compare(arg, "Supervisor", true) == 0 || string.Compare(arg, "Maintenance", true) == 0 || string.Compare(arg, "Engineer", true) == 0) { ConfigurationManager.AppSettings["SystemOperationMode"] = arg; break; } } EventLoggerAccess logger = new EventLoggerAccess(); _UIManager = new UIManager(logger); _DataAccess = new DataAccess(logger); _AssemblyManager = new AssemblyManager(_UIManager, _DataAccess, logger); _DataAccess.StartUp(); _UIManager.Show(); logger.LogInfo("Dashboard Client Started"); } else { Application.Current.Shutdown(); } } else { Process current = Process.GetCurrentProcess(); foreach (Process process in Process.GetProcessesByName(current.ProcessName)) { SetForegroundWindow(process.MainWindowHandle); } Application.Current.Shutdown(); } }
/// <summary> /// 初始化实体类型注册 /// </summary> public virtual void Initialize() { var dict = _entityRegistersDict; Type[] types = AssemblyManager.FindTypesByBase <IEntityRegister>(); if (types.Length == 0 || _initialized) { _logger.LogDebug("数据库上下文实体已初始化,跳过"); return; } //创建实体映射类的实例 List <IEntityRegister> registers = types.Select(type => Activator.CreateInstance(type) as IEntityRegister).ToList(); List <IGrouping <Type, IEntityRegister> > groups = registers.GroupBy(m => m.DbContextType).ToList(); Type key; dict.Clear(); foreach (IGrouping <Type, IEntityRegister> group in groups) { key = group.Key ?? typeof(DefaultDbContext); List <IEntityRegister> list = dict.ContainsKey(key) ? dict[key].ToList() : new List <IEntityRegister>(); list.AddRange(group); dict[key] = list.ToArray(); } //添加框架的一些默认实体的实体映射信息(如果不存在) key = typeof(DefaultDbContext); if (dict.ContainsKey(key)) { List <IEntityRegister> list = dict[key].ToList(); list.AddIfNotExist(new EntityInfoConfiguration(), m => m.EntityType.IsBaseOn <IEntityInfo>()); list.AddIfNotExist(new FunctionConfiguration(), m => m.EntityType.IsBaseOn <IFunction>()); list.AddIfNotExist(new KeyValueConfiguration(), m => m.EntityType.IsBaseOn <IKeyValue>()); dict[key] = list.ToArray(); } foreach (KeyValuePair <Type, IEntityRegister[]> item in dict) { foreach (IEntityRegister register in item.Value) { _logger.LogDebug($"数据上下文 {item.Key} 添加实体类型 {register.EntityType} "); } _logger.LogInformation($"数据上下文 {item.Key} 添加了 {item.Value.Length} 个实体"); } _initialized = true; }
private IList GetExtensionAspects() { IList extensionAspects = new ArrayList(); foreach (IClassMap classMap in this.Context.DomainMap.ClassMaps) { IList generatedPropertyMaps = classMap.GetGeneratedPropertyMaps(); if (generatedPropertyMaps.Count > 0) { Type targetType = AssemblyManager.GetBaseType( this.context.AssemblyManager.MustGetTypeFromClassMap(classMap)); TypeExtender extender = new TypeExtender(); SignatureAspect aspect = new SignatureAspect(classMap.Name + "GeneratedPropertiesExtender", targetType, new Type[] { }, new IPointcut[] { }); foreach (IPropertyMap generatedPropertyMap in generatedPropertyMaps) { ExtendedProperty property = new ExtendedProperty(); property.Name = generatedPropertyMap.Name; property.FieldName = generatedPropertyMap.GetFieldName(); if (generatedPropertyMap.IsCollection) { property.Type = typeof(IList); } else { if (generatedPropertyMap.ReferenceType != ReferenceType.None) { IClassMap refClassMap = generatedPropertyMap.MustGetReferencedClassMap(); property.Type = AssemblyManager.GetBaseType( this.context.AssemblyManager.MustGetTypeFromClassMap(refClassMap)); } else { property.Type = Type.GetType(generatedPropertyMap.DataType); } } extender.Members.Add(property); } aspect.TypeExtenders.Add(extender); extensionAspects.Add(aspect); } } return(extensionAspects); }
public void Inject() { var typeName = Guid.NewGuid().ToString("N"); var methodName = Guid.NewGuid().ToString("N"); AssemblyManager.Manage((assembly) => { var traceAttributeCtor = assembly.MainModule.Import( typeof(TraceAttribute).GetConstructor(Type.EmptyTypes)); var attribute = new CustomAttribute(traceAttributeCtor); var type = AssemblyManager.AddType(assembly, typeName); var method = AssemblyManager.AddMethod(type, methodName); method.CustomAttributes.Add(attribute); var processor = method.Body.GetILProcessor(); processor.Append(Instruction.Create(OpCodes.Ret)); }, (assembly) => { var injector = new TraceAttribute(); var targetMethod = (from type in assembly.MainModule.GetAllTypes() where type.Name == typeName from method in type.Methods where method.Name == methodName select method).First(); Assert.AreEqual(1, targetMethod.Body.Instructions.Count); injector.Inject(targetMethod); var instructions = targetMethod.Body.Instructions; Assert.AreEqual(12, instructions.Count); Assert.AreEqual(OpCodes.Call, instructions[0].OpCode); Assert.AreEqual(OpCodes.Callvirt, instructions[1].OpCode); Assert.AreEqual(OpCodes.Stloc, instructions[2].OpCode); Assert.AreEqual(OpCodes.Ldloc, instructions[3].OpCode); Assert.AreEqual(OpCodes.Ldstr, instructions[4].OpCode); Assert.AreEqual(OpCodes.Call, instructions[5].OpCode); Assert.AreEqual(OpCodes.Call, instructions[6].OpCode); Assert.AreEqual(OpCodes.Ldloc, instructions[7].OpCode); Assert.AreEqual(OpCodes.Ldstr, instructions[8].OpCode); Assert.AreEqual(OpCodes.Call, instructions[9].OpCode); Assert.AreEqual(OpCodes.Call, instructions[10].OpCode); Assert.AreEqual(OpCodes.Ret, instructions[11].OpCode); }, false); }
private void AddDirectory(DirectoryInfo directory) { foreach (FileInfo file in directory.EnumerateFiles()) { if (file.Name == MainDataName) { AddFile(file.FullName); Logger.Log(LogType.Info, LogCategory.Import, $"'{MainDataName}' has been found at '{directory.FullName}'"); } else if (file.Name == GlobalGameManagerName) { AddFile(file.FullName); Logger.Log(LogType.Info, LogCategory.Import, $"'{GlobalGameManagerName}' has been found at '{directory.FullName}'"); } else if (m_levelName.IsMatch(file.Name)) { AddFile(file.FullName); Logger.Log(LogType.Info, LogCategory.Import, $"'{file.Name}' has been found at '{directory.FullName}'"); } else if (file.Extension == AssetBundleExtension) { string onlyName = Path.GetFileNameWithoutExtension(file.Name); m_files.Add(onlyName, file.FullName); Logger.Log(LogType.Info, LogCategory.Import, $"Asset bundle '{onlyName}' has been found at '{directory.FullName}'"); } else if (AssemblyManager.IsAssembly(file.Name)) { if (MonoManager.IsMonoAssembly(file.Name)) { m_fileCollection.AssemblyManager.ScriptingBackEnd = ScriptingBackEnd.Mono; } else { throw new NotImplementedException(); } m_assemblies.Add(file.FullName); Logger.Log(LogType.Info, LogCategory.Import, $"Assembly '{file.Name}' has been found at '{directory.FullName}'"); } } foreach (DirectoryInfo subDirectory in directory.EnumerateDirectories()) { AddDirectory(subDirectory); } }
/// <summary> /// Creates a new AnimaticStream. /// </summary> /// <param name="info">The file to get the /// AnimaticStream's information from.</param> public AnimaticStream(StreamInfo info, int streamNumber) { this.streamNumber = streamNumber; for (int i = 0; i < info.Actions.Length; i++) { object act = AssemblyManager.CreateInstance(info.Actions[i]); if (act is Action) { ((Action)act).OnComplete += new FinishedActionEvent(EndAction); actions.Add(act as Action); } } }
private void CollectAssembliesSafe(DirectoryInfo root, IDictionary <string, string> assemblies) { foreach (FileInfo file in root.EnumerateFiles()) { if (AssemblyManager.IsAssembly(file.Name)) { if (assemblies.ContainsKey(file.Name)) { Logger.Log(LogType.Warning, LogCategory.Import, $"Duplicate assemblies found: '{assemblies[file.Name]}' & '{file.FullName}'"); } else { assemblies.Add(file.Name, file.FullName); } } } }
/// <summary> /// Calculates the number of methods for a run. /// </summary> /// <param name="assemblyManager">The assembly manager.</param> /// <param name="assembly">The test assembly.</param> /// <param name="filter">The test run filter.</param> /// <returns>Returns the number of known methods returned.</returns> private static int CalculateTotalMethods(AssemblyManager assemblyManager, IAssembly assembly, TestRunFilter filter) { int total = 0; List<ITestClass> cls = filter.GetTestClasses(assembly, assemblyManager.ClassInstances); foreach (ITestClass test in cls) { object instance = assemblyManager.ClassInstances.GetInstance(test.Type); total += filter.GetTestMethods(test, instance).Count; } return total; }
internal static void DeleteComponent(string filePath, string assemblyName, string typeName, string progId, string assemblyFile) { try { AssemblyManager manager = new AssemblyManager(); string str = typeName + ", " + manager.GetFullName(assemblyFile); string str2 = typeName + ", " + assemblyName; XmlDocument configXml = new XmlDocument(); configXml.Load(filePath); XmlNode documentElement = configXml.DocumentElement; documentElement = FindOrCreateElement(configXml, documentElement, "system.runtime.remoting"); documentElement = FindOrCreateElement(configXml, documentElement, "application"); documentElement = FindOrCreateElement(configXml, documentElement, "service"); XmlNodeList list = documentElement.SelectNodes("descendant::*[attribute::type='" + str2 + "']"); while ((list != null) && (list.Count > 0)) { XmlNode oldChild = list.Item(0); if (oldChild.ParentNode != null) { oldChild.ParentNode.RemoveChild(oldChild); list = documentElement.SelectNodes("descendant::*[attribute::type='" + str2 + "']"); } } list = documentElement.SelectNodes("descendant::*[attribute::type='" + str + "']"); while ((list != null) && (list.Count > 0)) { XmlNode node3 = list.Item(0); if (node3.ParentNode != null) { node3.ParentNode.RemoveChild(node3); list = documentElement.SelectNodes("descendant::*[attribute::type='" + str + "']"); } } configXml.Save(filePath); } catch (DirectoryNotFoundException) { } catch (FileNotFoundException) { } catch (RegistrationException) { } catch (Exception exception) { if ((exception is NullReferenceException) || (exception is SEHException)) { throw; } ComSoapPublishError.Report(Resource.FormatString("Soap_ConfigDeletionFailure") + " " + exception.Message); throw; } }
public JobAssemblyController(AssemblyManager assemblyManager) { this.AssemblyManager = assemblyManager; }