/// <summary> /// Initialize a new instance of the <see cref="App"/> class. /// </summary> /// <param name="appResourcesService">A service with access to local resources.</param> /// <param name="logger">A logger from the built in LoggingFactory.</param> /// <param name="dataService">A service with access to data storage.</param> /// <param name="processService">A service with access to the process.</param> /// <param name="pdfService">A service with access to the PDF generator.</param> /// <param name="profileService">A service with access to profile information.</param> /// <param name="registerService">A service with access to register information.</param> /// <param name="prefillService">A service with access to prefill mechanisms.</param> /// <param name="instanceService">A service with access to instances</param> /// <param name="settings">General settings</param> /// <param name="textService">A service with access to text</param> /// <param name="httpContextAccessor">A context accessor</param> public App( IAppResources appResourcesService, ILogger <App> logger, IData dataService, IProcess processService, IPDF pdfService, IProfile profileService, IRegister registerService, IPrefill prefillService, IInstance instanceService, IOptions <GeneralSettings> settings, IText textService, IHttpContextAccessor httpContextAccessor) : base( appResourcesService, logger, dataService, processService, pdfService, prefillService, instanceService, registerService, settings, profileService, textService, httpContextAccessor) { _logger = logger; }
public IRegister[] GetPlugins() { List <IRegister> plugins = new List <IRegister>(); //load apis in the bin folder foreach (FileInfo assembly in new DirectoryInfo(HttpContext.Current.Server.MapPath("~/bin/")).GetFiles("*.dll").Where(fi => fi.Name != "HAP.Web.dll" && fi.Name != "HAP.Web.Configuration.dll" && !fi.Name.StartsWith("Microsoft"))) { Assembly a = Assembly.LoadFrom(assembly.FullName); foreach (Type type in a.GetTypes()) { if (!type.IsClass || type.IsNotPublic) { continue; } Type[] interfaces = type.GetInterfaces(); if (((IList)interfaces).Contains(typeof(IRegister))) { object obj = Activator.CreateInstance(type); IRegister t = (IRegister)obj; plugins.Add(t); } } } return(plugins.ToArray()); }
/// <summary> /// Initialize a new instance of the <see cref="App"/> class. /// </summary> /// <param name="appResourcesService">A service with access to local resources.</param> /// <param name="logger">A logger from the built in LoggingFactory.</param> /// <param name="dataService">A service with access to data storage.</param> /// <param name="processService">A service with access to the process.</param> /// <param name="pdfService">A service with access to the PDF generator.</param> /// <param name="profileService">A service with access to profile information.</param> /// <param name="registerService">A service with access to register information.</param> /// <param name="prefillService">A service with access to prefill mechanisms.</param> /// <param name="instanceService">A service with access to instances</param> /// <param name="settings">General settings</param> /// <param name="textService">A service with access to text</param> /// <param name="httpContextAccessor">A context accessor</param> public App( IAppResources appResourcesService, ILogger <App> logger, IData dataService, IProcess processService, IPDF pdfService, IProfile profileService, IRegister registerService, IPrefill prefillService, IInstance instanceService, IOptions <GeneralSettings> settings, IText textService, IHttpContextAccessor httpContextAccessor) : base( appResourcesService, logger, dataService, processService, pdfService, prefillService, instanceService, registerService, settings, profileService, textService, httpContextAccessor) { _logger = logger; _validationHandler = new ValidationHandler(httpContextAccessor); _calculationHandler = new CalculationHandler(); _instantiationHandler = new InstantiationHandler(profileService, registerService); _pdfHandler = new PdfHandler(); }
public void Setup() { _register = RegisterFactory.Create(); var composition = new Composition(_register, new TypeLoader(), Mock.Of <IProfilingLogger>(), ComponentTests.MockRuntimeState(RuntimeLevel.Run)); composition.Register(_ => Mock.Of <ILogger>()); composition.Register(_ => Mock.Of <IDataTypeService>()); composition.Register(_ => Mock.Of <IContentSection>()); composition.RegisterUnique <IMediaPathScheme, OriginalMediaPathScheme>(); composition.Configs.Add(SettingsForTests.GetDefaultGlobalSettings); composition.Configs.Add(SettingsForTests.GetDefaultUmbracoSettings); composition.ComposeFileSystems(); composition.Configs.Add(SettingsForTests.GetDefaultUmbracoSettings); _factory = composition.CreateFactory(); Current.Reset(); Current.Factory = _factory; // make sure we start clean // because some tests will create corrupt or weird filesystems FileSystems.Reset(); }
public Alu(IBus bus, IControlUnit controlUnit, IRegister aReg, IRegister bReg) { Bus = bus; this.aReg = aReg; this.bReg = bReg; busOutputLine = controlUnit.GetControlLine(ControlLineId.SUM_OUT); subLine = controlUnit.GetControlLine(ControlLineId.SUBTRACT); subLine.onTransition = () => { // When the sub line changes, pull the value to refresh it, and the flags byte val = Value; return(true); }; busOutputLine.onTransition = () => { if (busOutputLine.State == true) { Bus.Driver = this; } else { if (Bus.Driver == this) { Bus.Driver = null; } } return(true); }; }
protected override bool[] GetShifter(IRegister <IByte> inputRegister) { var(secondRegisterInput, shiftOut) = _rightByteShifter.Shift(inputRegister.Output, ShiftIn); ShiftOut = shiftOut; return(secondRegisterInput.ToBits()); }
private void RegisterTypes(IRegister register) { lock (_locker) { if (_registeredTypes != null) { return; } var types = GetRegisteringTypes(_types).ToArray(); // ensure they are safe foreach (var type in types) { EnsureType(type, "register"); } // register them - ensuring that each item is registered with the same lifetime as the collection. // NOTE: Previously each one was not registered with the same lifetime which would mean that if there // was a dependency on an individual item, it would resolve a brand new transient instance which isn't what // we would expect to happen. The same item should be resolved from the container as the collection. foreach (var type in types) { register.Register(type, CollectionLifetime); } _registeredTypes = types; } }
/// <summary> /// Initializes a new instance of the <see cref="InstancesController"/> class /// </summary> public InstancesController( ILogger <InstancesController> logger, IRegister registerService, IInstance instanceService, IData dataService, IAppResources appResourcesService, IAltinnApp altinnApp, IProcess processService, IPDP pdp, IEvents eventsService, IOptions <AppSettings> appSettings, IPrefill prefillService) { _logger = logger; _instanceService = instanceService; _dataService = dataService; _appResourcesService = appResourcesService; _registerService = registerService; _altinnApp = altinnApp; _processService = processService; _pdp = pdp; _eventsService = eventsService; _appSettings = appSettings.Value; _prefillService = prefillService; }
protected RegisterBase(string name, int size, IRegister high, IRegister low) { this.Name = name; this.Size = size; this.High = high; this.Low = low; }
/// <summary> /// Writes a byte to the selected register address. /// </summary> /// <param name="register">The register to write the data.</param> public void WriteByte(IRegister register) { Write(register.Address, new byte[] { register.ToByte() }); }
/// <summary> /// Initialize a new instance of <see cref="AppBase"/> class with the given services. /// </summary> /// <param name="resourceService">The service giving access to local resources.</param> /// <param name="logger">A logging service.</param> /// <param name="dataService">The service giving access to data.</param> /// <param name="processService">The service giving access the App process.</param> /// <param name="pdfService">The service giving access to the PDF generator.</param> /// <param name="prefillService">The service giving access to prefill mechanisms.</param> /// <param name="instanceService">The service giving access to instance data</param> /// <param name="registerService">The service giving access to register data</param> /// <param name="settings">the general settings</param> /// <param name="profileService">the profile service</param> /// <param name="textService">The text service</param> /// <param name="httpContextAccessor">the httpContextAccessor</param> protected AppBase( IAppResources resourceService, ILogger <AppBase> logger, IData dataService, IProcess processService, IPDF pdfService, IPrefill prefillService, IInstance instanceService, IRegister registerService, IOptions <GeneralSettings> settings, IProfile profileService, IText textService, IHttpContextAccessor httpContextAccessor) { _appMetadata = resourceService.GetApplication(); _resourceService = resourceService; _logger = logger; _dataService = dataService; _processService = processService; _pdfService = pdfService; _prefillService = prefillService; _instanceService = instanceService; _registerService = registerService; _userHelper = new UserHelper(profileService, registerService, settings); _profileService = profileService; _textService = textService; _httpContextAccessor = httpContextAccessor; }
/// <inheritdoc/> public override IFactory Boot(IRegister register) { // create and start asap to profile boot var debug = GlobalSettings.DebugMode; if (debug) { _webProfiler = new WebProfiler(); _webProfiler.Start(); } else { // should let it be null, that's how MiniProfiler is meant to work, // but our own IProfiler expects an instance so let's get one _webProfiler = new VoidProfiler(); } var factory = base.Boot(register); // factory can be null if part of the boot process fails if (factory != null) { // now (and only now) is the time to switch over to perWebRequest scopes. // up until that point we may not have a request, and scoped services would // fail to resolve - but we run Initialize within a factory scope - and then, // here, we switch the factory to bind scopes to requests factory.EnablePerWebRequestScope(); } return(factory); }
/// <summary> /// Initializes a new instance of the <see cref="ServiceAPIController"/> class. /// </summary> /// <param name="settings">The repository settings (set in Startup.cs).</param> /// <param name="generalSettings">The general settings (set in Startup.cs).</param> /// <param name="compilationService">The compilation service (set in Startup.cs).</param> /// <param name="authorizationService">The authorization service (set in Startup.cs).</param> /// <param name="logger">The logger (set in Startup.cs).</param> /// <param name="registerService">The register service (set in Startup.cs).</param> /// <param name="formService">The form service.</param> /// <param name="repositoryService">The repository service (set in Startup.cs).</param> /// <param name="executionService">The execution service (set in Startup.cs).</param> /// <param name="profileService">The profile service (set in Startup.cs).</param> /// <param name="httpContextAccessor">The http context accessor.</param> /// <param name="workflowSI">The workflow service.</param> /// <param name="instanceSI">The instance si</param> public ServiceAPIController( IOptions <ServiceRepositorySettings> settings, IOptions <GeneralSettings> generalSettings, ICompilation compilationService, IAuthorization authorizationService, ILogger <ServiceAPIController> logger, IRegister registerService, IForm formService, IRepository repositoryService, IExecution executionService, IProfile profileService, IHttpContextAccessor httpContextAccessor, IWorkflowSI workflowSI, IInstance instanceSI) { _settings = settings.Value; _generalSettings = generalSettings.Value; _compilation = compilationService; _authorization = authorizationService; _logger = logger; _register = registerService; _form = formService; _repository = repositoryService; _execution = executionService; _profile = profileService; _userHelper = new UserHelper(_profile, _register); _httpContextAccessor = httpContextAccessor; _workflowSI = workflowSI; _instance = instanceSI; }
// Create the RegField public RegField32(string bitFieldName, int startBit, int sizeInBits, IRegister reg) : base(bitFieldName, startBit, sizeInBits, REG_SIZE) { mRegister = reg; mMask = (int)CreateMask(REG_SIZE, sizeInBits, startBit); }
public void Apply(IRegister <IByte> inputRegister, IRegister <IByte> outputRegister) { inputRegister.Apply(); var secondRegisterInput = GetShifter(inputRegister); outputRegister.Input = _byteFactory.Create(secondRegisterInput); outputRegister.Apply(); }
public Application(IRegister register, ILogin login, IBaseUser baseUser, IAdminUser admin, IRegularUser regular) { _register = register; _login = login; _baseUser = baseUser; _adminFunction = admin; _regularFunction = regular; }
public AuthController( IAuthenticate login, IRegister register ) { _login = login; _register = register; }
public static IRegister WithAddressAssert(this IRegister register, int address) { if (register.Address != address) { throw new InvalidRegistersException("Assert on register address was failed"); } return(register); }
public void ForAll(IRegister r) { var rpyProcess = new LiveProcess($"{PluginContext.Dir}/rwy/rwy.py"); r.RegisterInstance <IPyProcess>(rpyProcess, DILifeTime.Singleton); r.Register <IInitializer, Initializer>(DILifeTime.Singleton); }
private void load_xx_mmmm(IRegister <ushort> XX) { var addr = WordAtPCPlusInitialOpcodeLength; XX.Value = Memory.GetWordAt(addr); WZ.Value = addr; WZ.Inc(); }
public LoggingRegister(IRegister <T> baseRegister, string registerName, TextWriter logger, bool logReads = true, bool logWrites = true) { _baseRegister = baseRegister; _registerName = registerName; _logger = logger; _logReads = logReads; _logWrites = logWrites; }
public void Show() { if (_view == null) { _view = new frmRegister(); } _view.Show(); }
private void load_mmmm_xx(IRegister <ushort> XX) { var addr = WordAtPCPlusInitialOpcodeLength; Memory.SetWordAt(WordAtPCPlusInitialOpcodeLength, XX.Value); WZ.Value = addr; WZ.Inc(); }
public StatusRegister(IRegister register) { if(register.Type != Registers.Status) { throw new ArgumentException("Only IRegister instances with the type Registers.Status are allowed in the class StatusRegister"); } this.Register = register; }
public AuthService(IRegister register, ILogin login, IEdit edit, IIncrement increment, IRefreshProfile refresh) { _register = register; _login = login; _edit = edit; _increment = increment; _refresh = refresh; }
public void Setup() { this.transScope = new TransactionScope(); var paymentProcessor = new PaymentProcessor(new PaymentDao()); register = new Register(paymentProcessor); }
private void ex_spm(IRegister <ushort> r2) { ushort temp = SPM.Value; SPM.Value = r2.Value; r2.Value = temp; WZ.Value = r2.Value; }
public void SetUp() { _notification = MockRepository.GenerateMock<INotification>(); _register = MockRepository.GenerateMock<IRegister>(); _listener = new TcpListener(IPAddress.Loopback, 11111); _client = new TcpClient(); _connection = new Connection(_client, _notification, _register); }
public void FinalStateMatches() { const int peopleCount = 10, firstIdNumber = 0, secondIdNumber = 3, thirdIdNumber = 7; decimal amount = 20.123m; string giverId, takerId, thirdId; long debtDealId; using (var dbsProvider = new TestDBsProvider()) { using (var w = new RegistersWrapper(dbsProvider)) { var dbc = w.DB.Tables.DbContext; new TablesDbPopulator(dbc).AddPeople(peopleCount); IRegister rwRoot = w.New.Register(); var roRoot = (IRegisterReader)rwRoot; IPeopleRegisterReader roPeople = roRoot.People; giverId = roPeople.All.OrderBy(p => p.Id) .Skip(firstIdNumber).First().Id; takerId = roPeople.All.OrderBy(p => p.Id) .Skip(secondIdNumber).First().Id; thirdId = roPeople.All.OrderBy(p => p.Id) .Skip(thirdIdNumber).First().Id; debtDealId = rwRoot.Debts.Deals.Add(new DebtDealRow { Time = DateTime.Now, GiverId = giverId, TakerId = takerId, Amount = amount }); } using (var w = new RegistersWrapper(dbsProvider)) { var rdbc = w.DB.Tables.DbContextForReader; var roRoot = (IRegisterReader)w.New.Register(); this.CheckPairDebtsRegister( roRoot.Debts.Pairs, rdbc, giverId, takerId, thirdId, amount); this.CheckPersonDebtsRegister( roRoot.Debts.Person, rdbc, giverId, takerId, thirdId, amount); this.CheckDebtDealsRegister( roRoot.Debts.Deals, rdbc, debtDealId, giverId, takerId, thirdId, amount); this.CheckAchieversRegister( roRoot.Debts.Achievers, w.DB.Documents.AchieversCollection, giverId, takerId, amount); } } }
private void sll(IRegister <byte> r) { bool cf = (r.Value & 0x80) == 0x80; int newVal = (r.Value << 1) | 0x01; F.Value = SZ53P(newVal); CF = cf; r.Value = (byte)newVal; }
private DateTime?GetPaymentApplicationDate(IRegister invoice) { var businessDate = PaymentEntry.Accessinfo.BusinessDate.GetValueOrDefault(); var invoiceDate = invoice.DocDate.GetValueOrDefault(); return(businessDate < invoiceDate ? invoiceDate : businessDate); }
private void srl(IRegister <byte> r) { bool cf = (r.Value & 0x01) == 0x01; int newVal = (r.Value >> 1); F.Value = SZ53P(newVal); CF = cf; r.Value = (byte)newVal; }
// GET: Login public RegisterController() { var bl = new BusinessLogic.BussinesLogic(); _register = bl.GetRegisterBL(); var ss = new BusinessLogic.BussinesLogic(); _session = ss.GetSessionBL(); }
public StatusRegister WriteRegister([NotNull] IRegister register) { if (register == null) { throw new ArgumentNullException(nameof(register)); } return(WriteRegister(register.Type, register.Value)); }
public void Init(IRegister view) { _view = view; _accountRepository = ObjectFactory.GetInstance<IAccountRepository>(); _permissionRepository = ObjectFactory.GetInstance<IPermissionRepository>(); _termRepository = ObjectFactory.GetInstance<ITermRepository>(); _accountService = ObjectFactory.GetInstance<IAccountService>(); _webContext = ObjectFactory.GetInstance<IWebContext>(); _email = ObjectFactory.GetInstance<IEmail>(); _configuration = ObjectFactory.GetInstance<IConfiguration>(); _view.LoadTerms(_termRepository.GetCurrentTerm()); }
public Connection(TcpClient client, INotification notification, IRegister register) { if (notification == null) throw new ArgumentNullException("notification"); if(register == null) throw new ArgumentNullException("register"); _disposed = false; _client = client ?? new TcpClient(); _notification = notification; _register = register; }
public void Init(IRegister view, bool IsPostBack) { _view = view; _email = ObjectFactory.GetInstance<IEmail>(); _webContext = ObjectFactory.GetInstance<IWebContext>(); _accountService = ObjectFactory.GetInstance<IAccountService>(); _friendService = ObjectFactory.GetInstance<IFriendService>(); if (!IsPostBack) _view.LoadTerms(Term.GetCurrentTerm()); if (!string.IsNullOrEmpty(_webContext.FriendshipRequest)) { friendInvitation = FriendInvitation.GetFriendInvitationByGUID(new Guid(_webContext.FriendshipRequest)); _view.LoadEmailAddressFromFriendInvitation(friendInvitation.Email); } }
override protected void _vertexShader() { vertexUV = (IRegister)assign(VARYING[0], "vertexUV"); vertexNormal = (IRegister)assign(VARYING[1], "vertexNormal"); vertexPos = (IRegister)assign(VARYING[2], "vertexPos"); lightPos = (IRegister)assign(VARYING[3], "lightPos"); var viewMatrix = (IRegister)assign(CONST[0], "viewMatrix"); // Pass texture uv to the fragment shader move(vertexUV, ATTRIBUTE[2]); // Pass the light position to the fragment shader move(lightPos, CONST[4]); // Transform vertex normal and pass to the fragment shader multiply4x4(vertexNormal, ATTRIBUTE[1], viewMatrix); // Transform vertex position, pass to fragment and output multiply4x4(vertexPos, ATTRIBUTE[0], viewMatrix); multiply4x4(OUTPUT, ATTRIBUTE[0], viewMatrix); }
public void SetRegister(IRegister register) { if (disposed) { throw new InvalidOperationException("Mutative access to closed session"); } Processor.registers = Processor.registers.SetItem(register.Type, register); Processor.NotifyRegisterChanged(register); }
private void RegisterChanged(IProcessor processor, IRegister register) { registerChanges[register.Type] = register; }
private Message PerformMapping(IRegister source) { return Mapping.Map<IRegister, Register>(source); }
/// <summary>Asserts that the given expected register is equal to the actual register with the same type.</summary> /// <param name="expected"></param> /// <param name="message"></param> public void AssertRegisterEquals(IRegister expected, string message = null) { var actual = Processor.Registers[expected.Type]; Assert.AreEqual(expected.Value, actual.Value, message ?? $"Register {expected.Type} does not have the expected value"); }
public void SetUp() { _notification = MockRepository.GenerateMock<INotification>(); _register = MockRepository.GenerateMock<IRegister>(); _client = new TcpClient(); _connection = new Connection(_client, _notification, _register); }
public IAuthenticationResponse Register(IRegister model) { UserManager<AppUser> usermanager = new UserManager<AppUser>(new UserStore<AppUser>(new AppDbContext(_config.UniConnection))); // allow alphanumeric characters in username usermanager.UserValidator = new UserValidator<AppUser>(usermanager) { AllowOnlyAlphanumericUserNames = false }; AppUser user = new AppUser { UserName = model.Email, }; Task<IdentityResult> result = usermanager.CreateAsync(user, model.Password); IdentityResult a = result.Result; IAuthenticationResponse response = new AuthenticationResponse(); return response; }
public void Init(IRegister View) { _view = View; if (!string.IsNullOrEmpty(_webContext.FriendshipRequest)) { friendInvitation = _friendInvitationRepository.GetFriendInvitationByGUID(new Guid(_webContext.FriendshipRequest)); _view.LoadEmailAddressFromFriendInvitation(friendInvitation.Email); } }
public HomeController(IRegister register) { this.register = register; }
/// <summary> /// Registers the user. /// </summary> /// <param name="userToRegister">The user to register.</param> /// <returns></returns> /// <exception cref="ParameterNullException">userToRegister</exception> public IRegisterUserResult RegisterUser(IRegister userToRegister) { if (ReferenceEquals(null, userToRegister)) { throw new ParameterNullException("userToRegister"); } var registerUserResult = RegisterUserResult.Create(); var existingUserName = this.userRoleRepository.Get(u => u.User.UserName == userToRegister.UserName).FirstOrDefault(); if (existingUserName != null) { registerUserResult.MembershipCreateStatus = MembershipCreateStatus.DuplicateUserName; return registerUserResult; } var newMembership = this.membershipService.CreateMembershipUser(userToRegister.UserName, userToRegister.Password, userToRegister.UserEmail, DefaultPasswordQuestion, DefaultPasswordAnswer, true, MembershipPasswordFormat.Hashed); if ((newMembership.MembershipId > 0) && (newMembership.UserId > 0)) { registerUserResult.Success = this.profileService.AddProfile(newMembership.UserId, userToRegister.PersonId, true, true) > 0; var roleId = userToRegister.RoleId <= 0 ? this.roleRepository.Get(x => x.Description == DefaultMemberRole).First().RoleId : userToRegister.RoleId; this.userRoleRepository.AddUserToRole(newMembership.UserId, roleId); // Update to hashed password userToRegister.Password = newMembership.Password; } return registerUserResult; }
public void Init(IRegister View) { _view = View; }
public void Setup() { _connection = MockRepository.GenerateStub<IConnection>(); _nodeProvider = MockRepository.GenerateMock<INodeProvider>(); _notification = MockRepository.GenerateMock<INotification>(); _register = new Register(_connection, _nodeProvider, _notification); }