Here are the examples of the csharp api System.AppDomain.GetAssemblies() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1645 Examples
19
Source : TestConfigFactory.cs
with MIT License
from bilal-fazlani
with MIT License
from bilal-fazlani
internal static TestConfig? GetDefaultFromSubClreplaced()
{
try
{
var configs = AppDomain.CurrentDomain
.Getreplacedemblies()
.Where(a => !a.IsDynamic)
.SelectMany(replacedembly => replacedembly.ExportedTypes)
.Where(t => t.IsClreplaced && t.InheritsFrom<IDefaultTestConfig>())
.Select(t =>
{
var defaultTestConfig = (IDefaultTestConfig) Activator.CreateInstance(t)!;
var config = defaultTestConfig.Default;
if (config.Source.IsNullOrWhitespace())
{
config.Source = t.FullName;
}
return config;
})
.OrderBy(c => c.Priority ?? int.MaxValue)
.ToList();
/*
if (configs.Count > 1)
{
var csv = configs.Select(c => $"{c.Priority}: {c.Source}").ToCsv(NewLine);
Console.WriteLine($"Found more than one {nameof(TestConfig)} subclreplaced. Using the one with lowest priority: {NewLine}{csv}");
}
*/
return configs.FirstOrDefault();
}
catch (Exception e)
{
Console.WriteLine($"Unable to load default test configs:{NewLine}{e}");
return null;
}
}
19
Source : EventMapper.cs
with MIT License
from binarymash
with MIT License
from binarymash
private void RegisterEventTypes()
{
_registeredEventTypes = new Dictionary<string, Type>();
var eventTypes = AppDomain.CurrentDomain.Getreplacedemblies()
.Where(a => a.FullName.StartsWith("Evelyn.Core"))
.SelectMany(a => a.GetLoadableTypes().Where(IsConcreteEvent));
foreach (var eventType in eventTypes)
{
_registeredEventTypes.Add(eventType.FullName, eventType);
}
}
19
Source : CompileService.cs
with MIT License
from BlazorComponents
with MIT License
from BlazorComponents
public async Task Init()
{
if (references == null)
{
references = new List<MetadataReference>();
foreach (var replacedembly in AppDomain.CurrentDomain.Getreplacedemblies())
{
if (replacedembly.IsDynamic)
{
continue;
}
var name = replacedembly.GetName().Name + ".dll";
Console.WriteLine(name);
references.Add(
MetadataReference.CreateFromStream(
await this._http.GetStreamAsync(_uriHelper.BaseUri+ "/_framework/_bin/" + name)));
}
}
}
19
Source : EditContextFluentValidationExtensions.cs
with MIT License
from Blazored
with MIT License
from Blazored
private static IValidator GetValidatorForModel(IServiceProvider serviceProvider, object model, bool disablereplacedemblyScanning)
{
var validatorType = typeof(IValidator<>).MakeGenericType(model.GetType());
if (serviceProvider != null)
{
try
{
if (serviceProvider.GetService(validatorType) is IValidator validator)
{
return validator;
}
}
catch (Exception)
{
}
}
if (disablereplacedemblyScanning)
{
return null;
}
foreach (var replacedembly in AppDomain.CurrentDomain.Getreplacedemblies().Where(i => !Scannedreplacedembly.Contains(i.FullName)))
{
try
{
replacedemblyScanResults.AddRange(FindValidatorsInreplacedembly(replacedembly));
}
catch (Exception)
{
}
Scannedreplacedembly.Add(replacedembly.FullName);
}
var interfaceValidatorType = typeof(IValidator<>).MakeGenericType(model.GetType());
Type modelValidatorType = replacedemblyScanResults.FirstOrDefault(i => interfaceValidatorType.IsreplacedignableFrom(i.InterfaceType))?.ValidatorType;
if (modelValidatorType == null)
{
return null;
}
return (IValidator)ActivatorUtilities.CreateInstance(serviceProvider, modelValidatorType);
}
19
Source : WebAssemblyHostBuilderExtensions.cs
with MIT License
from blazorhero
with MIT License
from blazorhero
public static WebreplacedemblyHostBuilder AddClientServices(this WebreplacedemblyHostBuilder builder)
{
builder
.Services
.AddLocalization(options =>
{
options.ResourcesPath = "Resources";
})
.AddAuthorizationCore(options =>
{
RegisterPermissionClaims(options);
})
.AddBlazoredLocalStorage()
.AddMudServices(configuration =>
{
configuration.SnackbarConfiguration.PositionClreplaced = Defaults.Clreplacedes.Position.BottomRight;
configuration.SnackbarConfiguration.HideTransitionDuration = 100;
configuration.SnackbarConfiguration.ShowTransitionDuration = 100;
configuration.SnackbarConfiguration.VisibleStateDuration = 3000;
configuration.SnackbarConfiguration.ShowCloseIcon = false;
})
.AddAutoMapper(AppDomain.CurrentDomain.Getreplacedemblies())
.AddScoped<ClientPreferenceManager>()
.AddScoped<BlazorHeroStateProvider>()
.AddScoped<AuthenticationStateProvider, BlazorHeroStateProvider>()
.AddManagers()
.AddExtendedAttributeManagers()
.AddTransient<AuthenticationHeaderHandler>()
.AddScoped(sp => sp
.GetRequiredService<IHttpClientFactory>()
.CreateClient(ClientName).EnableIntercept(sp))
.AddHttpClient(ClientName, client =>
{
client.DefaultRequestHeaders.AcceptLanguage.Clear();
client.DefaultRequestHeaders.AcceptLanguage.ParseAdd(CultureInfo.DefaultThreadCurrentCulture?.TwoLetterISOLanguageName);
client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress);
})
.AddHttpMessageHandler<AuthenticationHeaderHandler>();
builder.Services.AddHttpClientInterceptor();
return builder;
}
19
Source : ServiceCollectionExtensions.cs
with MIT License
from blazorhero
with MIT License
from blazorhero
internal static void RegisterSwagger(this IServiceCollection services)
{
services.AddSwaggerGen(async c =>
{
//TODO - Lowercase Swagger Doreplacedents
//c.DoreplacedentFilter<LowercaseDoreplacedentFilter>();
//Refer - https://gist.github.com/rafalkasa/01d5e3b265e5aa075678e0adfd54e23f
// include all project's xml comments
var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
foreach (var replacedembly in AppDomain.CurrentDomain.Getreplacedemblies())
{
if (!replacedembly.IsDynamic)
{
var xmlFile = $"{replacedembly.GetName().Name}.xml";
var xmlPath = Path.Combine(baseDirectory, xmlFile);
if (File.Exists(xmlPath))
{
c.IncludeXmlComments(xmlPath);
}
}
}
c.SwaggerDoc("v1", new OpenApiInfo
{
Version = "v1",
replacedle = "BlazorHero.CleanArchitecture",
License = new OpenApiLicense
{
Name = "MIT License",
Url = new Uri("https://opensource.org/licenses/MIT")
}
});
var localizer = await GetRegisteredServerLocalizerAsync<ServerCommonResources>(services);
c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
Name = "Authorization",
In = ParameterLocation.Header,
Type = SecuritySchemeType.ApiKey,
Scheme = "Bearer",
BearerFormat = "JWT",
Description = localizer["Input your Bearer token in this format - Bearer {your token here} to access this API"],
});
c.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme,
Id = "Bearer",
},
Scheme = "Bearer",
Name = "Bearer",
In = ParameterLocation.Header,
}, new List<string>()
},
});
});
}
19
Source : StartupExtensions.cs
with GNU General Public License v3.0
from blqw
with GNU General Public License v3.0
from blqw
public static IList<replacedembly> LoadAllreplacedemblies(this AppDomain domain, string path) =>
_cache.GetOrAdd(path, p =>
{
var dm = AppDomain.CreateDomain("temp");
foreach (var dll in Directory.GetFiles(p, "*.dll", SearchOption.AllDirectories))
{
try
{
var replaced = dm.Load(File.ReadAllBytes(dll));
domain.Load(replaced.GetName());
}
catch (Exception) { }
}
AppDomain.Unload(dm);
return domain.Getreplacedemblies().ToList().AsReadOnly();
});
19
Source : StartupExtensions.cs
with GNU General Public License v3.0
from blqw
with GNU General Public License v3.0
from blqw
public static IEnumerable<Type> FindStartupTypesByAttribute(this AppDomain domain)
=> FindStartupTypesByAttribute(domain?.Getreplacedemblies());
19
Source : StartupExtensions.cs
with GNU General Public License v3.0
from blqw
with GNU General Public License v3.0
from blqw
public static IEnumerable<Type> FindStartupTypesByName(this AppDomain domain)
=> FindStartupTypesByName(domain?.Getreplacedemblies());
19
Source : TypeExtensions.cs
with MIT License
from BLUDRAG
with MIT License
from BLUDRAG
public static Type GetInstanceType(string strFullyQualifiedName)
{
string sanitizedName = strFullyQualifiedName.Replace("PPtr<$", "").Replace(">", "");
Type type = Type.GetType(sanitizedName);
if(type != null) return type;
foreach(replacedembly asm in AppDomain.CurrentDomain.Getreplacedemblies())
{
Module[] modules = asm.GetModules();
foreach(Module module in modules)
{
foreach(Type _type in module.GetTypes())
{
if(_type.Name == sanitizedName)
return _type;
}
}
}
return null;
}
19
Source : NodeEditorReflection.cs
with MIT License
from BLUDRAG
with MIT License
from BLUDRAG
public static Type[] GetDerivedTypes(Type baseType) {
List<System.Type> types = new List<System.Type>();
System.Reflection.replacedembly[] replacedemblies = System.AppDomain.CurrentDomain.Getreplacedemblies();
foreach (replacedembly replacedembly in replacedemblies) {
try {
types.AddRange(replacedembly.GetTypes().Where(t => !t.IsAbstract && baseType.IsreplacedignableFrom(t)).ToArray());
} catch (ReflectionTypeLoadException) { }
}
return types.ToArray();
}
19
Source : NodeDataCache.cs
with MIT License
from BLUDRAG
with MIT License
from BLUDRAG
private static void BuildCache() {
portDataCache = new PortDataCache();
System.Type baseType = typeof(Node);
List<System.Type> nodeTypes = new List<System.Type>();
System.Reflection.replacedembly[] replacedemblies = System.AppDomain.CurrentDomain.Getreplacedemblies();
replacedembly selfreplacedembly = replacedembly.Getreplacedembly(baseType);
if (selfreplacedembly.FullName.StartsWith("replacedembly-CSharp") && !selfreplacedembly.FullName.Contains("-firstpreplaced")) {
// If xNode is not used as a DLL, check only CSharp (fast)
nodeTypes.AddRange(selfreplacedembly.GetTypes().Where(t => !t.IsAbstract && baseType.IsreplacedignableFrom(t)));
} else {
// Else, check all relevant DDLs (slower)
// ignore all unity related replacedemblies
// never ignore current executing replacedembly
replacedembly executingreplacedembly = replacedembly.GetExecutingreplacedembly();
foreach (replacedembly replacedembly in replacedemblies) {
if(replacedembly != executingreplacedembly) {
if (replacedembly.FullName.StartsWith("Unity")) continue;
// unity created replacedemblies always have version 0.0.0
if (!replacedembly.FullName.Contains("Version=0.0.0")) continue;
}
nodeTypes.AddRange(replacedembly.GetTypes().Where(t => !t.IsAbstract && baseType.IsreplacedignableFrom(t)).ToArray());
}
}
for (int i = 0; i < nodeTypes.Count; i++) {
CachePorts(nodeTypes[i]);
}
}
19
Source : Utils.cs
with MIT License
from blueberryzzz
with MIT License
from blueberryzzz
public static List<Type> GetAllTypes(bool exclude_generic_definition = true)
{
List<Type> allTypes = new List<Type>();
var replacedemblies = AppDomain.CurrentDomain.Getreplacedemblies();
for (int i = 0; i < replacedemblies.Length; i++)
{
try
{
#if (UNITY_EDITOR || XLUA_GENERAL) && !NET_STANDARD_2_0
if (!(replacedemblies[i].ManifestModule is System.Reflection.Emit.ModuleBuilder))
{
#endif
allTypes.AddRange(replacedemblies[i].GetTypes()
.Where(type => exclude_generic_definition ? !type.IsGenericTypeDefinition() : true)
);
#if (UNITY_EDITOR || XLUA_GENERAL) && !NET_STANDARD_2_0
}
#endif
}
catch (Exception)
{
}
}
return allTypes;
}
19
Source : SubscriptionPrompt.cs
with MIT License
from boformer
with MIT License
from boformer
private static void ShowError(string reason, string solution)
{
var affectedreplacedemblyNames = new StringBuilder();
var replacedemblies = AppDomain.CurrentDomain.Getreplacedemblies();
foreach (var replacedembly in replacedemblies)
{
if (RequiresHarmony2(replacedembly))
{
affectedreplacedemblyNames.Append("• ").Append(GetModName(replacedembly)).Append('\n');
}
}
var message = $"The mod(s):\n{affectedreplacedemblyNames}require the dependency 'Harmony' to work correctly!\n\n{reason}\n\n{solution}";
UIView.library.ShowModal<ExceptionPanel>("ExceptionPanel").SetMessage("Missing dependency: Harmony", message, false);
}
19
Source : Mod.cs
with MIT License
from boformer
with MIT License
from boformer
public void OnEnabled() {
UnityEngine.Debug.Log($"[DomainPoker] Get ready to be poked!");
foreach (var asm in AppDomain.CurrentDomain.Getreplacedemblies()) {
try {
UnityEngine.Debug.Log($"Calling GetExportedTypes() for {asm}");
asm.GetExportedTypes();
UnityEngine.Debug.Log($"GetExportedTypes successful!");
UnityEngine.Debug.Log($"Calling GetTypes() for {asm}");
asm.GetTypes();
UnityEngine.Debug.Log($"GetTypes successful!");
} catch (Exception e) {
UnityEngine.Debug.LogException(e);
}
}
}
19
Source : DefaultAssemblyLocator.cs
with GNU General Public License v3.0
from bonarr
with GNU General Public License v3.0
from bonarr
public virtual IList<replacedembly> Getreplacedemblies()
{
return AppDomain.CurrentDomain.Getreplacedemblies();
}
19
Source : TinyIoCNancyBootstrapper.cs
with GNU General Public License v3.0
from bonarr
with GNU General Public License v3.0
from bonarr
private static void AutoRegister(TinyIoCContainer container, IEnumerable<Func<replacedembly, bool>> ignoredreplacedemblies)
{
var replacedembly = typeof(NancyEngine).replacedembly;
container.AutoRegister(AppDomain.CurrentDomain.Getreplacedemblies().Where(a => !ignoredreplacedemblies.Any(ia => ia(a))), DuplicateImplementationActions.RegisterMultiple, t => t.replacedembly != replacedembly);
}
19
Source : PostProcessManager.cs
with MIT License
from bonzaiferroni
with MIT License
from bonzaiferroni
void ReloadBaseTypes()
{
CleanBaseTypes();
// Rebuild the base type map
var types = AppDomain.CurrentDomain.Getreplacedemblies()
.SelectMany(
a => a.GetTypes()
.Where(
t => t.IsSubclreplacedOf(typeof(PostProcessEffectSettings))
&& t.IsDefined(typeof(PostProcessAttribute), false)
)
);
foreach (var type in types)
{
settingsTypes.Add(type, type.GetAttribute<PostProcessAttribute>());
// Create an instance for each effect type, these will be used for the lowest
// priority global volume as we need a default state when exiting volume ranges
var inst = (PostProcessEffectSettings)ScriptableObject.CreateInstance(type);
inst.SetAllOverridesTo(true, false);
m_BaseSettings.Add(inst);
}
}
19
Source : EditorUtilities.cs
with MIT License
from bonzaiferroni
with MIT License
from bonzaiferroni
static void ReloadDecoratorTypes()
{
s_AttributeDecorators.Clear();
// Look for all the valid attribute decorators
var types = AppDomain.CurrentDomain.Getreplacedemblies()
.SelectMany(
a => a.GetTypes()
.Where(
t => t.IsSubclreplacedOf(typeof(AttributeDecorator))
&& t.IsDefined(typeof(DecoratorAttribute), false)
)
);
// Store them
foreach (var type in types)
{
var attr = type.GetAttribute<DecoratorAttribute>();
var decorator = (AttributeDecorator)Activator.CreateInstance(type);
s_AttributeDecorators.Add(attr.attributeType, decorator);
}
}
19
Source : EffectListEditor.cs
with MIT License
from bonzaiferroni
with MIT License
from bonzaiferroni
public void Init(PostProcessProfile replacedet, SerializedObject serializedObject)
{
replacedert.IsNotNull(replacedet);
replacedert.IsNotNull(serializedObject);
m_replacedet = replacedet;
m_SerializedObject = serializedObject;
m_SettingsProperty = serializedObject.FindProperty("settings");
replacedert.IsNotNull(m_SettingsProperty);
m_EditorTypes = new Dictionary<Type, Type>();
m_Editors = new List<PostProcessEffectBaseEditor>();
// Gets the list of all available postfx editors
var editorTypes = AppDomain.CurrentDomain.Getreplacedemblies()
.SelectMany(
a => a.GetTypes()
.Where(
t => t.IsSubclreplacedOf(typeof(PostProcessEffectBaseEditor))
&& t.IsDefined(typeof(PostProcessEditorAttribute), false)
)
).ToList();
// Map them to their corresponding settings type
foreach (var editorType in editorTypes)
{
var attribute = editorType.GetAttribute<PostProcessEditorAttribute>();
m_EditorTypes.Add(attribute.settingsType, editorType);
}
// Create editors for existing settings
for (int i = 0; i < m_replacedet.settings.Count; i++)
CreateEditor(m_replacedet.settings[i], m_SettingsProperty.GetArrayElementAtIndex(i));
// Keep track of undo/redo to redraw the inspector when that happens
Undo.undoRedoPerformed += OnUndoRedoPerformed;
}
19
Source : RecordersInventory.cs
with MIT License
from bonzajplc
with MIT License
from bonzajplc
static IEnumerable<KeyValuePair<Type, object[]>> FindRecorders()
{
var attribType = typeof(RecorderAttribute);
foreach (var a in AppDomain.CurrentDomain.Getreplacedemblies())
{
foreach (var t in a.GetTypes())
{
var attributes = t.GetCustomAttributes(attribType, false);
if (attributes.Length != 0)
yield return new KeyValuePair<Type, object[]>(t, attributes);
}
}
}
19
Source : FullFrameworkReflector.cs
with Apache License 2.0
from BoundfoxStudios
with Apache License 2.0
from BoundfoxStudios
public IEnumerable<Type> GetAllTypesFromAppDomain(Func<replacedembly, bool> predicate)
{
return AppDomain.CurrentDomain
.Getreplacedemblies()
.Where(a => !IsDynamic(a) && IsRelevant(a) && predicate(a))
.SelectMany(GetExportedTypes).ToArray();
}
19
Source : Bootstrapper.cs
with MIT License
from Bphots
with MIT License
from Bphots
private static void RegisterViewModelFactories(IStyletIoCBuilder builder)
{
var vmTypeList = (from domainreplacedembly in AppDomain.CurrentDomain.Getreplacedemblies()
from replacedemblyType in domainreplacedembly.GetTypes()
where typeof (ViewModelBase).IsreplacedignableFrom(replacedemblyType)
select replacedemblyType).Where(vmType => !vmType.IsGenericType && !vmType.IsAbstract).ToArray();
var method = typeof (IStyletIoCBuilder).GetMethod("Bind", new Type[] {});
foreach (var vm in vmTypeList)
{
var generic = method?.MakeGenericMethod(vm);
var bindTo = generic?.Invoke(builder, null) as IBindTo;
bindTo?.ToSelf();
}
builder.Bind<ViewModelFactory>().ToSelf().InSingletonScope();
}
19
Source : SteamVR_Utils.cs
with GNU General Public License v3.0
from brandonmousseau
with GNU General Public License v3.0
from brandonmousseau
public static System.Type FindType(string typeName)
{
var type = System.Type.GetType(typeName);
if (type != null) return type;
foreach (var a in System.AppDomain.CurrentDomain.Getreplacedemblies())
{
type = a.GetType(typeName);
if (type != null)
return type;
}
return null;
}
19
Source : AssemblyResolve.cs
with GNU General Public License v3.0
from BRH-Media
with GNU General Public License v3.0
from BRH-Media
public static replacedembly HandleResolve(object sender, ResolveEventArgs args)
{
// The filename of the DLL being loaded
var filename = args.Name.Split(',')[0] + ".dll".ToLower();
// Ignore missing resources and autogenerated XmlSerializers binary
if (args.Name.Contains(".resources") || args.Name.Contains(@".XmlSerializers"))
{
// Log the replacedembly event
LogreplacedemblyResolve(filename, @"Skipped; replacedembly deemed non-critical.");
return null;
}
// Check for replacedemblies already loaded
var replacedembly = AppDomain.CurrentDomain.Getreplacedemblies().FirstOrDefault(a => a.FullName == args.Name);
if (replacedembly != null)
{
// Log the replacedembly event
LogreplacedemblyResolve(filename, @"Loaded; automatically found and loaded.");
return replacedembly;
}
// Log the replacedembly event
LogreplacedemblyResolve(filename, @"Unloaded; not found.");
// We can't handle missing libraries if there's a missing PlexDL path
if (!string.IsNullOrEmpty(PlexDlLocation))
{
// Did the user specify a custom search directory? We need to try and fetch it.
var customDir = DifferentreplacedemblyPath();
// Top-most directory to search for libraries
var searchDir =
string.IsNullOrEmpty(customDir)
? PlexDlLocation
: customDir;
// Log the replacedembly event
LogreplacedemblyResolve(filename, $"Unloaded; searching directory '{searchDir}'.");
try
{
var toLoad = Directory.GetFiles(searchDir, filename, SearchOption.AllDirectories)
.Select(replacedembly.LoadFrom).FirstOrDefault();
if (toLoad != null)
{
// Log the replacedembly event
LogreplacedemblyResolve(filename, @"Loaded; found suitable location.");
return toLoad;
}
LogreplacedemblyResolve(filename, @"Unloaded; replacedembly null.");
}
catch (Exception ex)
{
// Log the replacedembly event
LogreplacedemblyResolve(filename, $"Unloaded; exception whilst loading :: {ex.Message}.");
}
}
// The replacedembly should have been resolved above, if it wasn't then
// error out and inform the user.
MessageBox.Show($"Referencing error:\n\n'{args.Name}' could not be found; the application failed to start.", @"Critical Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
// Kill current PlexDL process
Process.GetCurrentProcess().Kill();
// Default
return null;
}
19
Source : PlayFabEditorSDKTools.cs
with MIT License
from BrianPeek
with MIT License
from BrianPeek
public static Type GetPlayFabSettings()
{
if (playFabSettingsType == typeof(object))
return null; // Sentinel value to indicate that PlayFabSettings doesn't exist
if (playFabSettingsType != null)
return playFabSettingsType;
playFabSettingsType = typeof(object); // Sentinel value to indicate that PlayFabSettings doesn't exist
foreach (var replacedembly in AppDomain.CurrentDomain.Getreplacedemblies())
foreach (var eachType in replacedembly.GetTypes())
if (eachType.Name == PlayFabEditorHelper.PLAYFAB_SETTINGS_TYPENAME)
playFabSettingsType = eachType;
return playFabSettingsType == typeof(object) ? null : playFabSettingsType;
}
19
Source : PlayFabEditorSDKTools.cs
with MIT License
from BrianPeek
with MIT License
from BrianPeek
private static void CheckSdkVersion()
{
if (!string.IsNullOrEmpty(installedSdkVersion))
return;
var types = new List<Type>();
foreach (var replacedembly in AppDomain.CurrentDomain.Getreplacedemblies())
foreach (var type in replacedembly.GetTypes())
if (type.Name == "PlayFabVersion" || type.Name == PlayFabEditorHelper.PLAYFAB_SETTINGS_TYPENAME)
types.Add(type);
foreach (var type in types)
{
foreach (var property in type.GetProperties())
if (property.Name == "SdkVersion" || property.Name == "SdkRevision")
installedSdkVersion += property.GetValue(property, null).ToString();
foreach (var field in type.GetFields())
if (field.Name == "SdkVersion" || field.Name == "SdkRevision")
installedSdkVersion += field.GetValue(field).ToString();
}
}
19
Source : AssemblyResolver.cs
with Apache License 2.0
from bridgedotnet
with Apache License 2.0
from bridgedotnet
public static replacedembly CheckIfreplacedemblyLoaded(string fullreplacedemblyName, AppDomain domain)
{
var replacedemblies = domain.Getreplacedemblies();
foreach (var replacedembly in replacedemblies)
{
var replacedemblyName = new replacedemblyName(replacedembly.FullName);
if (replacedemblyName.Name == fullreplacedemblyName)
{
return replacedembly;
}
}
return null;
}
19
Source : AssemblyResolver.cs
with Apache License 2.0
from bridgedotnet
with Apache License 2.0
from bridgedotnet
public static replacedembly CheckIfFullreplacedemblyLoaded(replacedemblyName name, AppDomain domain)
{
var replacedemblies = domain.Getreplacedemblies();
foreach (var replacedembly in replacedemblies)
{
var replacedemblyName = new replacedemblyName(replacedembly.FullName);
if (replacedemblyName.FullName == name.FullName)
{
return replacedembly;
}
}
return null;
}
19
Source : ServiceCollectionBrighterBuilder.cs
with MIT License
from BrighterCommand
with MIT License
from BrighterCommand
public IBrighterHandlerBuilder AutoFromreplacedemblies()
{
var replacedemblies = AppDomain.CurrentDomain.Getreplacedemblies().Where(a => !a.IsDynamic).ToArray();
MapperRegistryFromreplacedemblies(replacedemblies);
HandlersFromreplacedemblies(replacedemblies);
AsyncHandlersFromreplacedemblies(replacedemblies);
return this;
}
19
Source : MockPlatformServices.cs
with MIT License
from brminnick
with MIT License
from brminnick
public replacedembly[] Getreplacedemblies() => AppDomain.CurrentDomain.Getreplacedemblies();
19
Source : ReflectionUtils.cs
with MIT License
from BrunoS3D
with MIT License
from BrunoS3D
public static IEnumerable<replacedembly> GetFullreplacedemblies() {
if (cache_replacedemblies.IsNullOrEmpty()) {
cache_replacedemblies = AppDomain.CurrentDomain.Getreplacedemblies();
}
return cache_replacedemblies;
}
19
Source : AssemblyUtilities.cs
with MIT License
from BrunoS3D
with MIT License
from BrunoS3D
public static void Reload()
{
lock (MAIN_LOCK)
{
dataPath = Environment.CurrentDirectory.Replace("\\", "//").Replace("//", "/").TrimEnd('/') + "/replacedets";
scriptreplacedembliesPath = Environment.CurrentDirectory.Replace("\\", "//").Replace("//", "/").TrimEnd('/') + "/Library/Scriptreplacedemblies";
userreplacedemblies = new List<replacedembly>();
userEditorreplacedemblies = new List<replacedembly>();
pluginreplacedemblies = new List<replacedembly>();
pluginEditorreplacedemblies = new List<replacedembly>();
unityreplacedemblies = new List<replacedembly>();
unityEditorreplacedemblies = new List<replacedembly>();
otherreplacedemblies = new List<replacedembly>();
userTypes = new List<Type>();
userEditorTypes = new List<Type>();
pluginTypes = new List<Type>();
pluginEditorTypes = new List<Type>();
unityTypes = new List<Type>();
unityEditorTypes = new List<Type>();
otherTypes = new List<Type>();
stringTypeLookup = new Dictionary<string, Type>();
replacedemblyTypeFlagLookup = new Dictionary<replacedembly, replacedemblyTypeFlags>();
unityEnginereplacedembly = typeof(Vector3).replacedembly;
#if UNITY_EDITOR
unityEditorreplacedembly = typeof(UnityEditor.EditorWindow).replacedembly;
#endif
projectFolderDirectory = new DirectoryInfo(dataPath);
scriptreplacedembliesDirectory = new DirectoryInfo(scriptreplacedembliesPath);
allreplacedemblies = new List<replacedembly>();
allreplacedembliesImmutable = new ImmutableList<replacedembly>(allreplacedemblies);
var loadedreplacedemblies = AppDomain.CurrentDomain.Getreplacedemblies();
for (int i = 0; i < loadedreplacedemblies.Length; i++)
{
Registerreplacedembly_THREADSAFE(loadedreplacedemblies[i], mightNotBeInitialized: false);
}
}
}
19
Source : ReflectionUtils.cs
with MIT License
from BrunoS3D
with MIT License
from BrunoS3D
public static IEnumerable<replacedembly> YieldGetFullreplacedemblies() {
foreach (replacedembly replacedembly in AppDomain.CurrentDomain.Getreplacedemblies()) {
if (cache_replacedemblies.IsNullOrEmpty() || !cache_replacedemblies.Contains(replacedembly)) {
cache_replacedemblies = cache_replacedemblies.AddItem(replacedembly);
}
yield return replacedembly;
}
}
19
Source : Form1.cs
with Apache License 2.0
from BSidesPDX
with Apache License 2.0
from BSidesPDX
private void encrypt_Click(object sender, EventArgs e)
{
AppDomain myDomain = AppDomain.CurrentDomain;
replacedembly[] allreplacedemblies = myDomain.Getreplacedemblies();
replacedembly canYouReMe = null;
Type encrypt = null;
byte[] resultType = null;
foreach (replacedembly asm in allreplacedemblies)
{
string replacedemblyName = asm.FullName.ToString();
if (replacedemblyName.Contains("canYouREMe"))
{
canYouReMe = asm;
break;
}
return;
}
encrypt = canYouReMe.GetTypes().First(t => t.Name == "stager");
var methodInfo = encrypt.GetMethod("encryptTheFlag", BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public);
// 1.Put flag here
var result = methodInfo.Invoke(encrypt, new object[] { Encoding.UTF8.GetBytes("FLAG") });
resultType = (byte[])result;
encryptedencryptedFlag.Text = Convert.ToBase64String(resultType);
}
19
Source : PluginManager.cs
with MIT License
from btcpayserver
with MIT License
from btcpayserver
private static replacedembly[] GetDefaultLoadedPluginreplacedemblies()
{
return AppDomain.CurrentDomain.Getreplacedemblies()
.ToArray();
}
19
Source : RazorTestSourceInformationProvider.cs
with MIT License
from bUnit-dev
with MIT License
from bUnit-dev
private static IEnumerable<Type> GetRazorTestTypes()
{
var razorTestBaseType = typeof(RazorTestBase);
foreach (replacedembly a in AppDomain.CurrentDomain.Getreplacedemblies())
{
var name = a.FullName ?? string.Empty;
if (!name.StartsWith("Bunit", StringComparison.Ordinal))
continue;
foreach (Type t in a.ExportedTypes)
{
if (razorTestBaseType.IsreplacedignableFrom(t) && !t.IsAbstract)
yield return t;
}
}
}
19
Source : Lookup_ComponentManager.cs
with MIT License
from c0ffeeartc
with MIT License
from c0ffeeartc
private static void Scan_IComponents ( )
{
foreach (var replacedembly in AppDomain.CurrentDomain.Getreplacedemblies())
{
foreach (var type in replacedembly.GetTypes())
{
if ( !((IList) type.GetInterfaces()).Contains(typeof(IComponent)) )
{
continue;
}
if ( !IsInScope(type))
{
continue;
}
Register(type);
}
}
}
19
Source : Lookup_ComponentManager.cs
with MIT License
from c0ffeeartc
with MIT License
from c0ffeeartc
private static List<Type> Collect_EventAnyComps ( )
{
var eventComps = new List<Type>( );
foreach (var replacedembly in AppDomain.CurrentDomain.Getreplacedemblies( ) )
{
foreach (var type in replacedembly.GetTypes())
{
if ( !((IList) type.GetInterfaces()).Contains(typeof(IComponent))
|| !IsInScope(type)
|| !IsEventAnyChild(type) )
{
continue;
}
eventComps.Add( type );
}
}
return eventComps;
}
19
Source : Lookup_ComponentManager.cs
with MIT License
from c0ffeeartc
with MIT License
from c0ffeeartc
private static List<Type> Collect_EventAnyRemovedComps( )
{
var eventComps = new List<Type>();
foreach (var replacedembly in AppDomain.CurrentDomain.Getreplacedemblies())
{
foreach (var type in replacedembly.GetTypes())
{
if ( !((IList) type.GetInterfaces()).Contains(typeof(IComponent))
|| !IsInScope(type)
|| !IsEventAnyRemovedChild(type) )
{
continue;
}
eventComps.Add( type );
}
}
return eventComps;
}
19
Source : Lookup_ComponentManager.cs
with MIT License
from c0ffeeartc
with MIT License
from c0ffeeartc
private static List<Type> Collect_EventSelfComps ( )
{
var eventComps = new List<Type>();
foreach (var replacedembly in AppDomain.CurrentDomain.Getreplacedemblies())
{
foreach (var type in replacedembly.GetTypes())
{
if ( !((IList) type.GetInterfaces()).Contains(typeof(IComponent))
|| !IsInScope(type)
|| !IsEventSelfChild(type) )
{
continue;
}
eventComps.Add( type );
}
}
return eventComps;
}
19
Source : Lookup_ComponentManager.cs
with MIT License
from c0ffeeartc
with MIT License
from c0ffeeartc
private static List<Type> Collect_EventSelfRemovedComps( )
{
var eventComps = new List<Type>();
foreach (var replacedembly in AppDomain.CurrentDomain.Getreplacedemblies())
{
foreach (var type in replacedembly.GetTypes())
{
if ( !((IList) type.GetInterfaces()).Contains(typeof(IComponent))
|| !IsInScope(type)
|| !IsEventSelfRemovedChild(type) )
{
continue;
}
eventComps.Add( type );
}
}
return eventComps;
}
19
Source : Lookup_ScopeManager.cs
with MIT License
from c0ffeeartc
with MIT License
from c0ffeeartc
public static void RegisterAll ( )
{
if ( Scopes.Count > 0 )
{
return;
}
foreach (var replacedembly in AppDomain.CurrentDomain.Getreplacedemblies())
{
foreach (var type in replacedembly.GetTypes())
{
if ( !type.IsInterface
|| !((IList) type.GetInterfaces()).Contains(typeof(IScope))
// || IsScopeRegistered( type )
)
{
continue;
}
{
MethodInfo methodInfo = typeof(Lookup_ScopeManager).GetMethod( nameof(Lookup_ScopeManager.RegisterScope), BindingFlags.Static | BindingFlags.Public );
var generic = methodInfo.MakeGenericMethod( type );
generic.Invoke( null, null );
}
{
var managerType = typeof(Lookup_ComponentManager<>);
var genericManagerType = managerType.MakeGenericType(type);
MethodInfo methodInfo = genericManagerType.GetMethod( "Autoscan", BindingFlags.Static | BindingFlags.Public );
methodInfo.Invoke( null, null );
}
}
}
}
19
Source : ItemFactory.cs
with GNU General Public License v3.0
from caioavidal
with GNU General Public License v3.0
from caioavidal
private IItem CreateItem(IItemType itemType, Location location,
IDictionary<ItemAttribute, IConvertible> attributes)
{
if (itemType is null || itemType.TypeId < 100) return null;
if (itemType.Group == ItemGroup.ItemGroupDeprecated) return null;
if (itemType.Attributes.GetAttribute(ItemAttribute.Script) is { } script &&
!string.IsNullOrWhiteSpace(script))
{
var type = AppDomain.CurrentDomain.Getreplacedemblies().SelectMany(x => x.GetTypes())
.FirstOrDefault(x => x.Name.Equals(script));
if (type is not null &&
Activator.CreateInstance(type, itemType, location, attributes) is IItem instance) return instance;
}
if (DefenseEquipmentFactory.Create(itemType, location) is { } equipment) return equipment;
if (WeaponFactory.Create(itemType, location, attributes) is { } weapon) return weapon;
if (ContainerFactory.Create(itemType, location) is { } container) return container;
if (RuneFactory.Create(itemType, location, attributes) is { } rune) return rune;
if (GroundFactory.Create(itemType, location) is { } ground) return ground;
if (replacedulativeFactory.Create(itemType, location, attributes) is { } replacedulative) return replacedulative;
if (LiquidPool.IsApplicable(itemType)) return new LiquidPool(itemType, location, attributes);
if (MagicField.IsApplicable(itemType)) return new MagicField(itemType, location);
if (FloorChanger.IsApplicable(itemType)) return new FloorChanger(itemType, location);
if (Teleporreplacedem.IsApplicable(itemType)) return new Teleporreplacedem(itemType, location, attributes);
if (UsableOnItem.IsApplicable(itemType))
{
if (FloorChangerUsableItem.IsApplicable(itemType))
return new FloorChangerUsableItem(itemType, location);
if (TransformerUsableItem.IsApplicable(itemType)) return new TransformerUsableItem(itemType, location);
}
return GenericItemFactory.Create(itemType, location);
}
19
Source : AreaTypeLoader.cs
with GNU General Public License v3.0
from caioavidal
with GNU General Public License v3.0
from caioavidal
public void Load()
{
var types = AppDomain.CurrentDomain.Getreplacedemblies();
var fields = types.SelectMany(x => x.GetTypes()).SelectMany(x => x.GetFields())
.Where(prop => prop.IsDefined(typeof(AreaTypeAttribute), false));
foreach (var field in fields)
{
var attr = field.GetCustomAttribute<AreaTypeAttribute>();
if (attr is not null) _areaTypeStore.Add(attr.Name, field);
}
}
19
Source : EventInjection.cs
with GNU General Public License v3.0
from caioavidal
with GNU General Public License v3.0
from caioavidal
private static void RegisterEventSubscribers(this ContainerBuilder builder)
{
var types = AppDomain.CurrentDomain.Getreplacedemblies();
builder.RegisterreplacedemblyTypes(types).As<ICreatureEventSubscriber>().SingleInstance();
builder.RegisterreplacedemblyTypes(types).As<IItemEventSubscriber>().SingleInstance();
builder.RegisterreplacedemblyTypes(types).As<IChatChannelEventSubscriber>().SingleInstance();
}
19
Source : LoaderInjection.cs
with GNU General Public License v3.0
from caioavidal
with GNU General Public License v3.0
from caioavidal
private static void RegisterStartupLoaders(this ContainerBuilder builder)
{
var types = AppDomain.CurrentDomain.Getreplacedemblies();
builder.RegisterreplacedemblyTypes(types).As<IStartupLoader>().SingleInstance();
}
19
Source : PlayerLoader.cs
with GNU General Public License v3.0
from caioavidal
with GNU General Public License v3.0
from caioavidal
public virtual void AddExistingPersonalChannels(IPlayer player)
{
if (player is null) return;
var personalChannels = AppDomain.CurrentDomain.Getreplacedemblies().SelectMany(x => x.GetTypes())
.Where(x => typeof(PersonalChatChannel).IsreplacedignableFrom(x));
foreach (var channel in personalChannels)
{
if (channel == typeof(PersonalChatChannel)) continue;
var createdChannel = _chatChannelFactory.Create(channel, null, player);
player.Channels.AddPersonalChannel(createdChannel);
}
}
19
Source : LoaderInjection.cs
with GNU General Public License v3.0
from caioavidal
with GNU General Public License v3.0
from caioavidal
public static ContainerBuilder AddLoaders(this ContainerBuilder builder)
{
builder.RegisterType<ItemTypeLoader>().SingleInstance();
builder.RegisterType<WorldLoader>().SingleInstance();
builder.RegisterType<SpawnLoader>().SingleInstance();
builder.RegisterType<MonsterLoader>().SingleInstance();
builder.RegisterType<VocationLoader>().SingleInstance();
builder.RegisterPlayerLoaders();
builder.RegisterStartupLoaders();
builder.RegisterType<SpellLoader>().SingleInstance();
builder.RegisterCustomLoaders();
builder.RegisterreplacedemblyTypes(AppDomain.CurrentDomain.Getreplacedemblies()).As<IRunBeforeLoaders>()
.SingleInstance();
builder.RegisterreplacedemblyTypes(AppDomain.CurrentDomain.Getreplacedemblies()).As<IStartup>().SingleInstance();
return builder;
}
19
Source : ServiceInjection.cs
with GNU General Public License v3.0
from caioavidal
with GNU General Public License v3.0
from caioavidal
public static ContainerBuilder AddServices(this ContainerBuilder builder)
{
//Game services
builder.RegisterType<DealTransaction>().As<IDealTransaction>().SingleInstance();
builder.RegisterType<CoinTransaction>().As<ICoinTransaction>().SingleInstance();
builder.RegisterType<SharedExperienceConfiguration>().As<ISharedExperienceConfiguration>().SingleInstance();
builder.RegisterType<PartyInviteService>().As<IPartyInviteService>().SingleInstance();
builder.RegisterType<SummonService>().As<ISummonService>().SingleInstance();
//game builders
builder.RegisterreplacedemblyTypes(AppDomain.CurrentDomain.Getreplacedemblies()).As<IInspectionTextBuilder>()
.SingleInstance();
//application services
builder.RegisterType<HotkeyService>().SingleInstance();
return builder;
}
See More Examples