本文整理汇总了C#中IModuleContext类的典型用法代码示例。如果您正苦于以下问题:C# IModuleContext类的具体用法?C# IModuleContext怎么用?C# IModuleContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IModuleContext类属于命名空间,在下文中一共展示了IModuleContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnloadModules
public void UnloadModules(IModuleContext context)
{
foreach (var m in _loadedModules)
{
m.Unload(context);
}
}
示例2: Load
public void Load(IModuleContext context)
{
var settingsManager = context.ServiceLocator.GetInstance<ISettingsManager>();
settingsManager.RegisterSettings<PathSettings>();
context.ServiceLocator.RegisterSingleton<IDirectoryManager, DirectoryManager>();
}
示例3: GetMember
public IMember GetMember(IModuleContext context, string name) {
if (_attrs == null) {
Interlocked.CompareExchange(ref _attrs, new Dictionary<string, MemberInfo>(), null);
}
bool showClr = context == null || ((IronPythonModuleContext)context).ShowClr;
MemberInfo member;
if (!_attrs.TryGetValue(name, out member) || member.Member == null) {
var res = Interpreter.Remote.GetMember(Value, name);
if (!res.Equals(Value)) {
_attrs[name] = member = new MemberInfo(_interpreter.MakeObject(res));
}
}
if (!showClr) {
if (!(this is IronPythonNamespace)) { // namespaces always show all of their members...
switch (member.ClrOnly) {
case IsClrOnly.NotChecked:
CreateNonClrAttrs();
if (_attrs.ContainsKey(name) &&
_attrs[name].ClrOnly == IsClrOnly.Yes) {
return null;
}
break;
case IsClrOnly.No:
break;
case IsClrOnly.Yes:
return null;
}
}
}
return member.Member;
}
示例4: Load
public bool Load(IModuleContext context)
{
Should.NotBeNull(context, nameof(context));
var mode = _supportedModes & context.Mode;
if (_supportedModes.HasFlagEx(LoadMode.RuntimeDebug) || _supportedModes.HasFlagEx(LoadMode.RuntimeRelease))
{
if (mode != context.Mode)
return false;
}
else
{
if (mode == 0)
return false;
}
if (!_iocContainerCanBeNull && context.IocContainer == null)
return false;
lock (_locker)
{
_context = context;
_iocContainer = context.IocContainer;
_mode = context.Mode;
try
{
return LoadInternal();
}
finally
{
_context = null;
_iocContainer = null;
_mode = default(LoadMode);
}
}
}
示例5: Imported
public void Imported(IModuleContext context) {
if (Name == "clr") {
((IronPythonModuleContext)context).ShowClr = true;
} else if (Name == "wpf") {
AddWpfReferences();
}
}
示例6: ModuleView
public ModuleView(IPythonInterpreter interpreter, IModuleContext context, string name, string idbPath) {
_interpreter = interpreter;
_context = context;
Name = name;
_idbPath = idbPath;
_children = CalculateChildren().ToArray();
}
示例7: FunctionOverloadView
public FunctionOverloadView(IModuleContext context, string name, IPythonFunctionOverload overload) {
_context = context;
Name = name;
_overload = overload;
_prototype = new Lazy<string>(CalculatePrototype);
_returnTypes = new Lazy<IEnumerable<IAnalysisItemView>>(CalculateReturnTypes);
_parameters = new Lazy<IEnumerable<IAnalysisItemView>>(CalculateParameters);
}
示例8: GetAllMembers
public override IDictionary<string, IAnalysisSet> GetAllMembers(IModuleContext moduleContext) {
var mro = ClassInfo._mro;
if (!mro.IsValid) {
return new Dictionary<string, IAnalysisSet>();
}
// First item in MRO list is always the class itself.
return Values.Mro.GetAllMembersOfMro(mro.Skip(1), moduleContext);
}
示例9: Load
public void Load(IModuleContext context)
{
var persistenceManager = context.ServiceLocator.GetInstance<IPersistenceManager>();
persistenceManager.RegiserPersistenceProvider(SettingsPersistenceProviderKey, () => new ApplicationDataXmlPersistenceProvider());
context.ServiceLocator.RegisterSingleton<ISettingsManager, SettingsManager>();
context.ServiceLocator.Register<ISettingsEntryKeyBuilder, SettingsEntryKeyBuilder>();
}
示例10: Load
public void Load(IModuleContext context)
{
var settingsManager = context.ServiceLocator.GetInstance<ISettingsManager>();
settingsManager.RegisterSettings<KeyboardBindingSettings>();
settingsManager.RegisterSettings<GamepadBindingSettings>();
settingsManager.RegisterSettings<InputSettings>();
SetDefaults(settingsManager);
InputManager inputManager = new InputManager();
context.InputSourceAssembler.ConfigureInputSource((c) =>
{
var settings = settingsManager.LoadSettings<InputSettings>(c);
if (settings.IsUserInputEnabled)
{
var bindings = settingsManager.LoadSettings<KeyboardBindingSettings>(c);
KeyboardInputSource keyboard = new KeyboardInputSource(inputManager.GetKeyboard(), bindings);
return keyboard;
}
return null;
});
context.InputSourceAssembler.ConfigureInputSource((c) =>
{
var settings = settingsManager.LoadSettings<InputSettings>(c);
if (settings.IsUserInputEnabled)
{
CompositeInputSource cis = new CompositeInputSource();
for (Int32 i = 0; i < inputManager.GetJoystickCount(); i++)
{
var bindings = settingsManager.LoadSettings<GamepadBindingSettings>(c);
if (i == 0)
{
GamepadInputSource gamepad = new GamepadInputSource(inputManager.GetJoystick(i), bindings.Gamepad1Bindings);
cis.AddInputSource(gamepad);
}
else if (i == 1)
{
GamepadInputSource gamepad = new GamepadInputSource(inputManager.GetJoystick(i), bindings.Gamepad2Bindings);
cis.AddInputSource(gamepad);
}
}
return cis;
}
return null;
});
}
示例11: ModuleInfo
public ModuleInfo(string moduleName, ProjectEntry projectEntry, IModuleContext moduleContext)
{
_name = moduleName;
_projectEntry = projectEntry;
_sequences = new Dictionary<Node, INamespaceSet>();
_scope = new ModuleScope(this);
_weakModule = new WeakReference(this);
_context = moduleContext;
_scopes = new Dictionary<Node, InterpreterScope>();
}
示例12: Load
public void Load(IModuleContext context)
{
var settingsManager = context.ServiceLocator.GetInstance<ISettingsManager>();
var keybindings = new List<Wren.Core.Input.KeyboardBindingSettings.KeyBinding>();
keybindings.Add(new KeyboardBindingSettings.KeyBinding() { ButtonId = 100, Key = "Escape" });
keybindings.Add(new KeyboardBindingSettings.KeyBinding() { ButtonId = 101, Key = "M" });
var defaultKeybindings = new KeyboardBindingSettings() { Bindings = keybindings.ToArray() };
settingsManager.ApplySettings(defaultKeybindings, new EmulationContext(Game.Empty, new EmulatedSystem("WrenGame")), SettingsScope.EmulatedSystem);
}
示例13: ModuleInfo
public ModuleInfo(string moduleName, ProjectEntry projectEntry, IModuleContext moduleContext) {
_name = moduleName;
_projectEntry = projectEntry;
_sequences = new Dictionary<Node, IAnalysisSet>();
_scope = new ModuleScope(this);
_weakModule = new WeakReference(this);
_context = moduleContext;
_scopes = new Dictionary<Node, InterpreterScope>();
_referencedModules = new HashSet<ModuleReference>();
_unresolvedModules = new HashSet<string>(StringComparer.Ordinal);
}
示例14: ParameterView
public ParameterView(IModuleContext context, IParameterInfo parameter) {
_context = context;
_parameter = parameter;
_types = new Lazy<IEnumerable<IAnalysisItemView>>(CalculateTypes);
Name = _parameter.Name;
if (_parameter.IsParamArray) {
Name = "*" + Name;
} else if (_parameter.IsKeywordDict) {
Name = "**" + Name;
}
}
示例15: GetAllMembers
public override IDictionary<string, IAnalysisSet> GetAllMembers(IModuleContext moduleContext, GetMemberOptions options = GetMemberOptions.None) {
var res = new Dictionary<string, IAnalysisSet>();
foreach (var kvp in _scope.AllVariables) {
kvp.Value.ClearOldValues();
if (kvp.Value._dependencies.Count > 0) {
var types = kvp.Value.Types;
if (types.Count > 0) {
res[kvp.Key] = types;
}
}
}
return res;
}