本文整理汇总了C#中IModuleContext类的典型用法代码示例。如果您正苦于以下问题:C# IModuleContext类的具体用法?C# IModuleContext怎么用?C# IModuleContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IModuleContext类属于命名空间,在下文中一共展示了IModuleContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: UnloadModules
public void UnloadModules(IModuleContext context)
{
foreach (var m in _loadedModules)
{
m.Unload(context);
}
}
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:7,代码来源:ModuleLoader.cs
示例2: Load
public void Load(IModuleContext context)
{
var settingsManager = context.ServiceLocator.GetInstance<ISettingsManager>();
settingsManager.RegisterSettings<PathSettings>();
context.ServiceLocator.RegisterSingleton<IDirectoryManager, DirectoryManager>();
}
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:7,代码来源:DirectoryModule.cs
示例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;
}
开发者ID:wenh123,项目名称:PTVS,代码行数:34,代码来源:PythonObject.cs
示例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);
}
}
}
开发者ID:dbeattie71,项目名称:MugenMvvmToolkit,代码行数:33,代码来源:ModuleBase.cs
示例5: Imported
public void Imported(IModuleContext context) {
if (Name == "clr") {
((IronPythonModuleContext)context).ShowClr = true;
} else if (Name == "wpf") {
AddWpfReferences();
}
}
开发者ID:omnimark,项目名称:PTVS,代码行数:7,代码来源:IronPythonModule.cs
示例6: ModuleView
public ModuleView(IPythonInterpreter interpreter, IModuleContext context, string name, string idbPath) {
_interpreter = interpreter;
_context = context;
Name = name;
_idbPath = idbPath;
_children = CalculateChildren().ToArray();
}
开发者ID:wenh123,项目名称:PTVS,代码行数:7,代码来源:ModuleView.cs
示例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);
}
开发者ID:omnimark,项目名称:PTVS,代码行数:8,代码来源:FunctionOverloadView.cs
示例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);
}
开发者ID:wenh123,项目名称:PTVS,代码行数:8,代码来源:SuperInfo.cs
示例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>();
}
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:8,代码来源:SettingsModule.cs
示例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;
});
}
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:57,代码来源:InputModule.cs
示例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>();
}
开发者ID:borota,项目名称:JTVS,代码行数:10,代码来源:ModuleInfo.cs
示例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);
}
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:10,代码来源:WrenUIModule.cs
示例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);
}
开发者ID:jsschultz,项目名称:PTVS,代码行数:11,代码来源:ModuleInfo.cs
示例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;
}
}
开发者ID:wenh123,项目名称:PTVS,代码行数:12,代码来源:ParameterView.cs
示例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;
}
开发者ID:jsschultz,项目名称:PTVS,代码行数:13,代码来源:ModuleInfo.cs
示例16: Load
public void Load(IModuleContext context)
{
var directoryManager = context.ServiceLocator.GetInstance<IDirectoryManager>();
directoryManager.RegisterExtensionKey(RomExtensionKey, "nes");
directoryManager.RegisterExtensionKey(RomExtensionKey, "bin");
directoryManager.RegisterExtensionKey(RomExtensionKey, "sms");
// directoryManager.RegisterExtensionKey(RomExtensionKey, "zip");
var persistenceManager = context.ServiceLocator.GetInstance<IPersistenceManager>();
persistenceManager.RegiserPersistenceProvider(GameLibraryPersistenceProviderKey, () => new ApplicationDataXmlPersistenceProvider());
context.ServiceLocator.RegisterSingleton<IGameLibraryManager, GameLibraryManager>();
}
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:13,代码来源:GameLibraryModule.cs
示例17: LoadModules
public void LoadModules(IModuleContext context)
{
var moduleTypes = new List<Type>();
String path = Environment.CurrentDirectory;
foreach (var file in Directory.GetFiles(path, "*.Module.*.dll"))
{
var assembly = Assembly.LoadFile(file);
foreach (var type in assembly.GetExportedTypes())
{
if (typeof(IModule).IsAssignableFrom(type))
{
moduleTypes.Add(type);
}
}
}
List<Type> _dependencyGraph = new List<Type>();
List<Type> _invalidModules = new List<Type>();
while (_dependencyGraph.Count + _invalidModules.Count < moduleTypes.Count)
{
foreach (var type in moduleTypes)
{
if (_dependencyGraph.Contains(type))
continue;
if (_invalidModules.Contains(type))
continue;
var dependencies = type.GetCustomAttributes(typeof(ModuleDependencyAttribute), false).Cast<ModuleDependencyAttribute>();
if (dependencies.Count() == 0)
{
_dependencyGraph.Add(type);
continue;
}
CheckDependencies(moduleTypes, _invalidModules, type, dependencies, _dependencyGraph);
}
}
foreach (var m in _dependencyGraph)
{
var module = (IModule)Activator.CreateInstance(m);
module.Load(context);
_loadedModules.Add(module);
}
}
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:50,代码来源:ModuleLoader.cs
示例18: GetAllMembers
public override IDictionary<string, IAnalysisSet> GetAllMembers(IModuleContext moduleContext, GetMemberOptions options = GetMemberOptions.None) {
var res = new Dictionary<string, IAnalysisSet>();
if (_instanceAttrs != null) {
foreach (var kvp in _instanceAttrs) {
var types = kvp.Value.TypesNoCopy;
var key = kvp.Key;
kvp.Value.ClearOldValues();
if (kvp.Value.VariableStillExists) {
MergeTypes(res, key, types);
}
}
}
// check and see if it's defined in a base class instance as well...
if (!options.HasFlag(GetMemberOptions.DeclaredOnly)) {
foreach (var b in _classInfo.Bases) {
foreach (var ns in b) {
if (ns.Push()) {
try {
ClassInfo baseClass = ns as ClassInfo;
if (baseClass != null &&
baseClass.Instance._instanceAttrs != null) {
foreach (var kvp in baseClass.Instance._instanceAttrs) {
kvp.Value.ClearOldValues();
if (kvp.Value.VariableStillExists) {
MergeTypes(res, kvp.Key, kvp.Value.TypesNoCopy);
}
}
}
} finally {
ns.Pop();
}
}
}
}
foreach (var classMem in _classInfo.GetAllMembers(moduleContext)) {
MergeTypes(res, classMem.Key, classMem.Value);
}
}
return res;
}
开发者ID:jsschultz,项目名称:PTVS,代码行数:42,代码来源:InstanceInfo.cs
示例19: Load
public void Load(IModuleContext context)
{
var persistenceManager = context.ServiceLocator.GetInstance<IPersistenceManager>();
persistenceManager.RegiserPersistenceProvider(ReplayPersistenceProviderKey, () => new BinaryFilePersistenceProvider());
persistenceManager.RegiserPersistenceProvider(ReplayManagerPersistenceProviderKey, () => new ApplicationDataXmlPersistenceProvider());
var settingsManager = context.ServiceLocator.GetInstance<ISettingsManager>();
settingsManager.RegisterSettings<ReplaySettings>();
context.ServiceLocator.RegisterSingleton<IReplayManager, ReplayManager>();
var directoryManager = context.ServiceLocator.GetInstance<IDirectoryManager>();
context.InputSourceAssembler.ConfigurePipeline((c, i) =>
{
var settings = settingsManager.LoadSettings<ReplaySettings>(c);
if (settings.IsRecording)
{
return new RecordingInputSourceDecorator(i, Path.Combine(GetPath(c, directoryManager), settings.FileName), persistenceManager, 8);
}
else
{
return i;
}
});
context.InputSourceAssembler.ConfigureInputSource((c) =>
{
var settings = settingsManager.LoadSettings<ReplaySettings>(c);
if (settings.IsPlayingBack)
{
var pp = new BinaryFilePersistenceProvider();
var replay = pp.Load<ReplayData>(System.IO.Path.Combine(GetPath(c, directoryManager), settings.FileName));
return new PlaybackInputSource(replay, 8);
}
return null;
});
}
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:41,代码来源:ReplayModule.cs
示例20: Load
// public const String SettingsPersistenceName = "Settings.config";
public void Load(IModuleContext context)
{
var persistenceManager = context.ServiceLocator.GetInstance<IPersistenceManager>();
persistenceManager.RegiserPersistenceProvider(AchievementsPersistenceProviderKey, () => new RavenDbPersistenceProvider());
var settingsManager = context.ServiceLocator.GetInstance<ISettingsManager>();
settingsManager.RegisterSettings<AchievementSettings>();
AchievementSettings settings = new AchievementSettings();
settings.DefinitionsLastSynchronized = new DateTime(2000, 1, 1);
settings.StateLastDownloaded = new DateTime(2000, 1, 1);
settingsManager.ApplySettings(settings);
AchievementsManager manager =
new AchievementsManager(
new AchievementsService(),
settingsManager,
persistenceManager,
context.ServiceLocator.GetInstance<IEventAggregator>());
var gameLibraryManager = context.ServiceLocator.GetInstance<IGameLibraryManager>();
gameLibraryManager.RegisterGameInfoProvider(new AchievementGameInfoProvider(manager));
}
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:25,代码来源:AchievementsModule.cs
注:本文中的IModuleContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论