private static void EnsureLoaded() { if (s_providersByName != null) { return; } // Initialize lookup Dictionaries s_providersByName = new Dictionary <string, ITypeProvider>(StringComparer.OrdinalIgnoreCase); s_providersByType = new Dictionary <Type, ITypeProvider>(); // Add providers for primitive types Add(new PrimitiveTypeProvider <bool>()); Add(new PrimitiveTypeProvider <sbyte>()); Add(new PrimitiveTypeProvider <short>()); Add(new PrimitiveTypeProvider <ushort>()); Add(new PrimitiveTypeProvider <int>()); Add(new PrimitiveTypeProvider <uint>()); Add(new PrimitiveTypeProvider <long>()); Add(new PrimitiveTypeProvider <ulong>()); Add(new PrimitiveTypeProvider <float>()); Add(new PrimitiveTypeProvider <double>()); // Add configured type providers foreach (ITypeProvider provider in InterfaceLoader.BuildAll <ITypeProvider>()) { Add(provider); } }
public AutoFollow() { Behaviors = new InterfaceLoader <IBehavior>(); Instance = this; if (Settings.Misc.AlwaysEnablePlugin) { PluginManager.OnPluginsReloaded += PluginManager_OnPluginsReloaded; } }
private bool RunDeleteDataLogic(InterfaceLoader <IDeleteEvent <T> > interfaceLoader, Response <T> result, T model) { foreach (var interfaceImplementation in interfaceLoader.InterfaceImplementations) { if (!interfaceImplementation.Run(model, UnitOfWork, result)) { return(false); } } return(true); }
private bool RunRepoLogic(InterfaceLoader <IRepoRule <T, T2> > interfaceLoader, Response <T> result, T model, ICoreUser user) { foreach (var interfaceImplementation in interfaceLoader.InterfaceImplementations) { if (!interfaceImplementation.Run(model, ref DbSet, UnitOfWork, result, user)) { return(false); } } return(true); }
private bool RunViewListBusinessLogic(InterfaceLoader <IViewListRule <T, T2> > interfaceLoader, NgTable <T> result, NgTableParams ngTableParams, ICoreUser user) { foreach (var interfaceImplementation in interfaceLoader.InterfaceImplementations) { if (!interfaceImplementation.Run(ngTableParams, ref DbSet, result, user, UnitOfWork)) { return(false); } } return(true); }
private bool RunUpdateDataLogic(InterfaceLoader <IUpdateEvent <T, T2> > interfaceLoader, Response <T> result, T model, ICoreUser user) { foreach (var interfaceImplementation in interfaceLoader.InterfaceImplementations.OrderBy(c => c.priority())) { if (!interfaceImplementation.Run(model, ref DbSet, UnitOfWork, result, user)) { return(false); } } return(true); }
private bool RunInsertBusinessLogic(InterfaceLoader <IInsertRule <T> > interfaceLoader, Response <T> result, T model, ICoreUser user) { foreach (var interfaceImplementation in interfaceLoader.InterfaceImplementations) { if (!interfaceImplementation.Run(model, UnitOfWork, result, user)) { return(false); } } return(true); }
private bool RunViewBusinessLogic(InterfaceLoader <IViewRule <T> > interfaceLoader, Response <T> result, T model) { foreach (var interfaceImplementation in interfaceLoader.InterfaceImplementations) { if (!interfaceImplementation.Run(model, UnitOfWork, result)) { return(false); } } return(true); }
private bool RunViewDataLogic(InterfaceLoader <IViewEvent <T, T2> > interfaceLoader, Response <T> result, T model, ICoreUser user) { foreach (var interfaceImplementation in interfaceLoader.InterfaceImplementations) { var viewResult = interfaceImplementation.Run(model, ref DbSet, UnitOfWork, result, user); if (!result.Success) { return(false); } } return(true); }
private static void EnsureLoaded() { if (s_pipelineStageBuildersByName != null) { return; } s_pipelineStageBuildersByName = new Dictionary <string, IVerbBuilder>(StringComparer.OrdinalIgnoreCase); foreach (IVerbBuilder builder in InterfaceLoader.BuildAll <IVerbBuilder>()) { Add(builder); } }
private void Initialize() { Core.Logger.Log($"RoutineManager Initializing from thread {Thread.CurrentThread.ManagedThreadId}"); _routineLoader = new InterfaceLoader <IRoutine>(); _routineLoader.Load(); foreach (var routine in _routineLoader.Items) { var settings = routine.Value.RoutineSettings; settings?.Reset(); } }
static void Main() { var riritia = InterfaceLoader.GetHumanInterfaceInstance(); riritia.StartVoice("Irc"); riritia.StartMind("Keyword"); riritia.StartMind("HereToObserve"); riritia.StartMind("WhatIs"); while (true) { Thread.Sleep(100); } }
private bool RunInsertDataLogic(InterfaceLoader <IInsertEvent <T> > interfaceLoader, Response <T> result, T model) { foreach (var interfaceImplementation in interfaceLoader.InterfaceImplementations) { try { if (!interfaceImplementation.Run(model, UnitOfWork, result)) { return(false); } } catch (ObjectDisposedException ex) { // LogHelper.Error(typeof(IService<T>), "ObjectDisposedException = ", ex); result.LogError("Error with running IInsertEvent "); return(false); } catch (InvalidOperationException ex) { // LogHelper.Error(typeof(IService<T>), "ObjectDisposedException = ", ex); result.LogError("Error with running IInsertEvent "); return(false); } catch (DbEntityValidationException ex) { // LogHelper.Error(typeof(IService<T>), "DbEntityValidationException = ", ex); result.LogError("Error with running IInsertEvent "); return(false); } catch (DbUpdateConcurrencyException ex) { // LogHelper.Error(typeof(IService<T>), "DbUpdateConcurrencyException = ", ex); result.LogError("Error with running IInsertEvent "); return(false); } catch (DbUpdateException ex) { // LogHelper.Error(typeof(IService<T>), "DbUpdateException = ", ex); result.LogError("Error with running IInsertEvent "); return(false); } catch (Exception ex) { // LogHelper.Error(typeof(IService<T>), "Exception = ", ex); result.LogError("Error with running IInsertEvent "); return(false); } } return(true); }
/* This is called for interfaces to be loaded. */ public override void LoadInterfaces() { /*---Menus---*/ _pauseInterface = InterfaceLoader.LoadMenu(InterfaceLoader.Menus.EventPause, false); _eliminatedInterface = InterfaceLoader.LoadMenu(InterfaceLoader.Menus.Eliminated, false); _eventCompleteInterface = InterfaceLoader.LoadMenu(NgCampaign.Enabled ? InterfaceLoader.Menus.EventCompleteStandardCampaign : InterfaceLoader.Menus.EventCompleteStandard, false); /*---HUDs---*/ _speedAndShieldHud = CreateNewHuds(InterfaceLoader.Huds.SpeedAndShield); _notificationHud = CreateNewHuds(InterfaceLoader.Huds.NotificationBuffer); _timeHud = CreateNewHuds(InterfaceLoader.Huds.TimeStandard); _positionHud = CreateNewHuds(InterfaceLoader.Huds.Position); _lapHud = CreateNewHuds(InterfaceLoader.Huds.Lap); _weaponHud = CreateNewHuds(InterfaceLoader.Huds.Weapon); _nowPlayingHud = CreateNewHuds(InterfaceLoader.Huds.NowPlaying); }
// Loads a setup from a dll file thats implements the ISetup interface private void InitializeConfiguration() { try { ISetup setup = InterfaceLoader.Get <ISetup>(); if (setup is null) { throw new Exception("Could not find external configuration"); } setup.Initialize(Configuration); } catch { Configuration = new Configuration(); } }
// Check wether a .dll file implementing IDoBadStuff is available // if its available, it replaces the default bad stuff object private void InitializeBadStuff() { try { DoBadStuff = InterfaceLoader.Get <IDoBadStuff>(true); if (DoBadStuff is null) { DoBadStuff = new DefaultBadStuff(); } } catch (Exception ex) { DoBadStuff = new DefaultBadStuff(); if (Configuration.DebugMode) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private bool RunInsertDataLogic(InterfaceLoader <IInsertEvent <T> > interfaceLoader, Response <T> result, T model, ICoreUser user) { foreach (var interfaceImplementation in interfaceLoader.InterfaceImplementations) { try { if (!interfaceImplementation.Run(model, UnitOfWork, result, user)) { return(false); } } catch (ObjectDisposedException ex) { result.LogError("Error with running IInsertEvent " + ex.Message.ToString()); return(false); } catch (InvalidOperationException ex) { result.LogError("Error with running IInsertEvent " + ex.Message.ToString()); return(false); } catch (DbUpdateConcurrencyException ex) { result.LogError("Error with running IInsertEvent " + ex.Message.ToString()); return(false); } catch (DbUpdateException ex) { result.LogError("Error with running IInsertEvent " + String.Join(Environment.NewLine, ex.GetInnerExceptions().Select(c => c.Message))); return(false); } catch (Exception ex) { result.LogError("Error with running IInsertEvent " + ex.Message.ToString()); return(false); } } return(true); }
// Loads all languages private void InitializeLanguage() { List <ILanguage> languages = new List <ILanguage>(); try { languages = InterfaceLoader.GetAll <ILanguage>(); ILanguage language = languages.FirstOrDefault(x => x.Identifier == Configuration.DefaultLanguage); if (language is null) { throw new Exception("Could not find languages"); } Language = new Language(language.Identifier); language.Apply(Language); } catch { EnglishLanguage l = new EnglishLanguage(); Language = new Language(l.Identifier); l.Apply(Language); } CapsLockLabel.Text = Language.CapsLockText; WrongPasswordLabel.Text = Language.WrongPasswordText; LanguageButton.Text = Language.LanguageCode.ToUpper(); Controls.Add(ControlFactory.CreateLanguagePanel("languagePanel", languages, LanguageButton.Location.X + LanguageButton.Width, LanguageButton.Location.Y, Language)); Controls.Find("languagePanel", true).FirstOrDefault().Visible = false; foreach (ILanguage language in languages) { Controls.Find(language.Identifier + "1", true).FirstOrDefault().Click += LanguageClick; Controls.Find(language.Identifier + "2", true).FirstOrDefault().Click += LanguageClick; } }
public T OverwriteHook <T>(T NewDelegate) where T : class { fixed(VCR_t *ThisFixed = &this) return(InterfaceLoader.OverwriteVCRHook <T>(ThisFixed, NewDelegate)); }
public AutoFollow() { // Find and load all IBehavior instances Behaviors = new InterfaceLoader<IBehavior>(); Instance = this; }
private bool RunInsertDataLogic(InterfaceLoader <IInsertEvent <T> > interfaceLoader, Response <T> result, T model, ICoreUser user) { foreach (var interfaceImplementation in interfaceLoader.InterfaceImplementations) { try { if (!interfaceImplementation.Run(model, UnitOfWork, result, user)) { return(false); } } catch (ObjectDisposedException ex) { // LogHelper.Error(typeof(IService<T>), "ObjectDisposedException = ", ex); result.LogError("Error with running IInsertEvent "); return(false); } catch (InvalidOperationException ex) { // LogHelper.Error(typeof(IService<T>), "ObjectDisposedException = ", ex); result.LogError("Error with running IInsertEvent "); return(false); } catch (DbEntityValidationException ex) { result.LogError("Error with running IInsertEvent "); foreach (var eve in ex.EntityValidationErrors) { string errorString = $"Entity of type {eve.Entry.Entity.GetType().Name} in state {eve.Entry.State} has the following validation errors:"; foreach (var ve in eve.ValidationErrors) { errorString += $"{Environment.NewLine} - Property: {ve.PropertyName}, Error: {ve.ErrorMessage}"; } result.LogError(errorString); // LogHelper.Error(typeof(IService<T>), "DbEntityValidationException = ", ex); } result.LogError("Error with running IInsertEvent "); return(false); } catch (DbUpdateConcurrencyException ex) { // LogHelper.Error(typeof(IService<T>), "DbUpdateConcurrencyException = ", ex); result.LogError("Error with running IInsertEvent "); return(false); } catch (DbUpdateException ex) { // LogHelper.Error(typeof(IService<T>), "DbUpdateException = ", ex); result.LogError("Error with running IInsertEvent " + String.Join(Environment.NewLine, ex.GetInnerExceptions().Select(c => c.Message))); return(false); } catch (Exception ex) { // LogHelper.Error(typeof(IService<T>), "Exception = ", ex); result.LogError("Error with running IInsertEvent "); return(false); } } return(true); }
public AutoFollow() { // Find and load all IBehavior instances Behaviors = new InterfaceLoader <IBehavior>(); Instance = this; }