public void Load(IModuleContext context) { var settingsManager = context.ServiceLocator.GetInstance<ISettingsManager>(); settingsManager.RegisterSettings<PathSettings>(); context.ServiceLocator.RegisterSingleton<IDirectoryManager, DirectoryManager>(); }
public static void Initialize() { ServerAddress = "localhost:11648"; ObjectFactory.Configure(c => { c.ForRequestedType<IFrameRateTimerFactory>().TheDefaultIsConcreteType<FrameRateTimerFactory>().CacheBy(StructureMap.Attributes.InstanceScope.Singleton); c.ForRequestedType<IEmulationRunner>().TheDefault.Is.OfConcreteType<EmulationRunner>(); c.ForRequestedType<IEventAggregator>().TheDefaultIsConcreteType<EventAggregator>().CacheBy(StructureMap.Attributes.InstanceScope.Singleton); }); _serviceLocator = new ServiceLocator(); _serviceLocator.RegisterSingleton<IInputSourceAssembler, InputSourceAssembler>(); _serviceLocator.RegisterSingleton<IEmulatorRegistry, EmulatorRegistry>(); _loader = new ModuleLoader(); _context = new ModuleContext() { ServiceLocator = _serviceLocator, InputSourceAssembler = _serviceLocator.GetInstance<IInputSourceAssembler>(), EmulatorRegistry = _serviceLocator.GetInstance<IEmulatorRegistry>() }; _loader.LoadModules(_context); }
public void Imported(IModuleContext context) { if (Name == "clr") { ((IronPythonModuleContext)context).ShowClr = true; } else if (Name == "wpf") { AddWpfReferences(); } }
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); } } }
public FunctionView(IModuleContext context, string name, IPythonFunction member, bool isMethod) : base(context, name, member) { _function = member; _isMethod = isMethod; _returnTypes = new Lazy<IEnumerable<IAnalysisItemView>>(CalculateReturnTypes); }
public ModuleView(IPythonInterpreter interpreter, IModuleContext context, string name, string idbPath) { _interpreter = interpreter; _context = context; Name = name; _idbPath = idbPath; _children = CalculateChildren().ToArray(); }
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; }
public void UnloadModules(IModuleContext context) { foreach (var m in _loadedModules) { m.Unload(context); } }
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); }
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>(); }
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); }
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; }); }
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); }
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>(); }
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); }
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; } }
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; }
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>(); }
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); } }
public override IDictionary<string, IAnalysisSet> GetAllMembers(IModuleContext moduleContext, GetMemberOptions options = GetMemberOptions.None) { var mro = ClassInfo._mro; if (!mro.IsValid) { return new Dictionary<string, IAnalysisSet>(); } if (options.HasFlag(GetMemberOptions.DeclaredOnly)) { return Values.Mro.GetAllMembersOfMro(mro.Skip(1).Take(1), moduleContext, options); } // First item in MRO list is always the class itself. return Values.Mro.GetAllMembersOfMro(mro.Skip(1), moduleContext, options); }
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; }
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; }); }
// 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)); }
public IEnumerable <string> GetMemberNames(IModuleContext moduleContext) => DeclaringModule.GetMemberNames(moduleContext);
public IMember GetMember(IModuleContext context, string name) => DeclaringModule.GetMember(context, name);
public IEnumerable<string> GetMemberNames(IModuleContext moduleContext) { foreach (var key in _members.Keys) { yield return key; } if (_mro != null) { foreach (var type in _mro) { foreach (var key in type._members.Keys) { yield return key; } } } else if (_bases != null) { foreach (var type in _bases) { foreach (var key in type.GetMemberNames(moduleContext)) { yield return key; } } } }
protected virtual IObserverProvider GetObserverProvider(IModuleContext context) { return(null); }
internal IEnumerable <string> GetMemberNames(IModuleContext moduleContext) { return(_type.GetMemberNames(moduleContext)); }
private static void InitializeDesignTimeModules(IList<Assembly> assemblies, bool allAssemblies) { var designTimeManager = _designTimeManager; if (assemblies.Count == 0 || designTimeManager == null || !designTimeManager.IsDesignMode) return; IList<IModule> modules = assemblies.GetModules(false); if (modules.Count == 0) return; var context = new ModuleContext(designTimeManager.Platform, LoadMode.Design, designTimeManager.IocContainer, designTimeManager.Context, allAssemblies ? assemblies : GetAssemblies(true)); for (int i = 0; i < modules.Count; i++) { IModule module = modules[i]; var fullName = module.GetType().AssemblyQualifiedName; IModule oldModule; if (LoadedModules.TryGetValue(fullName, out oldModule)) { LoadedModules.Remove(fullName); oldModule.Unload(_lastContext); oldModule.TraceModule(false); } if (module.Load(context)) { LoadedModules[fullName] = module; module.TraceModule(true); } } _lastContext = context; }
internal IDictionary <string, IAnalysisSet> GetAllMembers(IMemberContainer container, IModuleContext moduleContext) { var names = container.GetMemberNames(moduleContext); var result = new Dictionary <string, IAnalysisSet>(); foreach (var name in names) { result[name] = GetAnalysisValueFromObjects(container.GetMember(moduleContext, name)); } var children = (container as IModule)?.GetChildrenPackages(moduleContext); if (children?.Any() ?? false) { foreach (var child in children) { IAnalysisSet existing; if (result.TryGetValue(child.Key, out existing)) { result[child.Key] = existing.Add(child.Value); } else { result[child.Key] = child.Value; } } } return(result); }
public IEnumerable <string> GetModuleMemberNames(IModuleContext context) { return(GetMemberNames(context)); }
public void Unload(IModuleContext context) { OnUnloaded(context); }
protected virtual IBindingMemberProvider GetBindingMemberProvider(IModuleContext context) { return(null); }
protected virtual bool CanLoad(IModuleContext context) { return(true); }
public AccountManager(IModuleContext context) { this.context = context; }
public void Load(IModuleContext context) { context.EmulatorRegistry.RegisterEmulator<SmsEmulator>(new EmulatedSystem("SMS")); }
internal IDictionary <string, IAnalysisSet> GetAllMembers(IMemberContainer container, IModuleContext moduleContext) { var names = container.GetMemberNames(moduleContext); var result = new Dictionary <string, IAnalysisSet>(); foreach (var name in names) { result[name] = GetAnalysisValueFromObjects(container.GetMember(moduleContext, name)); } return(result); }
public IEnumerable <string> GetMemberNames(IModuleContext moduleContext) => null;
public void Unload(IModuleContext context) { }
public IMember GetMember(IModuleContext context, string name) => null;
public IEnumerable <KeyValuePair <string, AnalysisValue> > GetChildrenPackages(IModuleContext context) { foreach (var name in _type.GetChildrenModules()) { yield return(new KeyValuePair <string, AnalysisValue>(name, ProjectState.GetAnalysisValueFromObjects(_type.GetMember(context, name)))); } }
/// <summary> /// Gets the <see cref="IBindingErrorProvider" /> that will be used by default. /// </summary> protected override IBindingErrorProvider GetBindingErrorProvider(IModuleContext context) { return new BindingErrorProvider(); }
public override IDictionary<string, INamespaceSet> GetAllMembers(IModuleContext moduleContext) { return _original.GetAllMembers(moduleContext); }
protected virtual IBindingManager GetBindingManager(IModuleContext context) { return(null); }
public IMember GetMember(IModuleContext context, string name) { IMember res; if (_members.TryGetValue(name, out res)) { return res; } if (_mro != null) { foreach (var mroType in _mro) { if (mroType._members.TryGetValue(name, out res)) { return res; } } } else if (_bases != null) { foreach (var baseType in _bases) { res = baseType.GetMember(context, name); if (res != null) { return res; } } } return null; }
public IMember GetMember(IModuleContext context, string name) => new UnionType( Types.Select(t => t.GetMember(context, name)).OfType <IPythonType>().ToArray() );
IEnumerable <KeyValuePair <string, AnalysisValue> > IModule.GetChildrenPackages(IModuleContext context) { foreach (var member in _members.OfType <IModule>()) { foreach (var keyValue in member.GetChildrenPackages(context)) { yield return(keyValue); } } }
protected virtual void OnUnloaded(IModuleContext context) { }
public IEnumerable <string> GetMemberNames(IModuleContext moduleContext) => Types.SelectMany(t => t.GetMemberNames(moduleContext));
protected virtual IBindingErrorProvider GetBindingErrorProvider(IModuleContext context) { return(new BindingErrorProviderBase()); }
public ManageModelQueryHandler(ILogger <ManageModelQueryHandler> logger, IModuleContext ctx) { _logger = logger; _ctx = ctx; }