public IdentityVerifier() { TrustValue = 70; #if Recording KELOG = new DataSet(); KElog = new DataTable(); KElog.Columns.Add(new DataColumn("SecurityId", typeof(string))); KElog.Columns.Add(new DataColumn("SampleId", typeof(string))); KElog.Columns.Add(new DataColumn("KeyEvent", typeof(int))); KElog.Columns.Add(new DataColumn("VkCode", typeof(ushort))); KElog.Columns.Add(new DataColumn("AbsoluteTimestamp", typeof(long))); KELOG.Tables.Add(KElog); #endif //Initialize the Keyboard Event table dsKeyboardEvents = new DataSet(); KeyboardEvents = new DataTable(); KeyboardEvents.Columns.Add(new DataColumn("SecurityId", typeof(string))); KeyboardEvents.Columns.Add(new DataColumn("SampleId", typeof(string))); KeyboardEvents.Columns.Add(new DataColumn("KeyEvent", typeof(int))); KeyboardEvents.Columns.Add(new DataColumn("VkCode", typeof(ushort))); KeyboardEvents.Columns.Add(new DataColumn("AbsoluteTimestamp", typeof(long))); dsKeyboardEvents.Tables.Add(KeyboardEvents); //Initialize feature extractor arguments FEargs = new FeatureExtractorArguments(); //Initialize the feature extractors extractors = new FeatureExtractor[]{new FeatureExtractor_IK(FEargs), new FeatureExtractor_KH(FEargs), new FeatureExtractor_KH_Next(FEargs), new FeatureExtractor_KH_Prev(FEargs), new FeatureExtractor_KPL(FEargs), new FeatureExtractor_KRL(FEargs)}; verifiers = new Verifiers(); }
private void btnAddProgram_Click(object sender, EventArgs e) { try { Verifiers.VerifyName(txbFood.Text); if (Verifiers.VerifyProgram(txbFood.Text)) { throw new CustomExceptions("Programa já existente."); } Verifiers.VerifyTimer(txbTimer.Text); int timer = int.Parse(txbTimer.Text); int power = Verifiers.VerifyPower(txbPower.Text); char character = Verifiers.VerifyChar(txbChar.Text); DefaultPrograms.AddCustomProgram(txbFood.Text, txbInstruction.Text, character, power, timer); ReadPrograms(); } catch (CustomExceptions errorMessage) { MessageBox.Show(errorMessage.Message); } catch (FormatException errorMessage) { MessageBox.Show(errorMessage.Message); } }
public IActionResult Index(string key) { int number = 6, fontSize = 16, height = 32; if (Request.Query.TryGetValue("n", out var qs) && int.TryParse(qs, out var value)) { number = value; } if (Request.Query.TryGetValue("s", out qs) && int.TryParse(qs, out value)) { fontSize = value; } if (Request.Query.TryGetValue("h", out qs) && int.TryParse(qs, out value)) { height = value; } using var ms = Verifiers.Create(out var code, number, fontSize, height); Response.Cookies.Append(key, Verifiers.Hashed(code), new CookieOptions { Expires = DateTimeOffset.Now.AddMinutes(3) }); Response.Body.Dispose(); return(File(ms.ToArray(), @"image/png")); }
public ViewModelMock() { this.countCallers = new CountCallers(this); this.countCalls = new CountCalls(this); this.handlers = new Handlers(this); this.verifications = new Verifications(this); this.verifiers = new Verifiers(this); }
public void Increase() { Nr++; Console.WriteLine(Nr); Verifiers?.Invoke(this, new ExampleArgs("Property notification")); System.Threading.Thread.Sleep(5000); Increase(); }
public void EmptyString() { string text = ""; Verifiers.VerifyName(text); Verifiers.VerifyTimer(text); Verifiers.VerifyChar(text); }
public StateManagerMock() { this.countCallers = new CountCallers(this); this.countCalls = new CountCalls(this); this.handlers = new Handlers(this); this.verifications = new Verifications(this); this.verifiers = new Verifiers(this); }
public ContactRepositoryMock() { this.countCallers = new CountCallers(this); this.countCalls = new CountCalls(this); this.handlers = new Handlers(this); this.verifications = new Verifications(this); this.verifiers = new Verifiers(this); }
private MoneyCollection(Currency currency) { Verifiers.ArgNullVerify(currency, nameof(currency)); Notes = Notes.Create(currency); Coins = Coins.Create(currency); Currency = currency; }
public EventSubscriptionMock() { this.countCallers = new CountCallers(this); this.countCalls = new CountCalls(this); this.handlers = new Handlers(this); this.verifications = new Verifications(this); this.verifiers = new Verifiers(this); }
public ContainerMock() { this.countCallers = new CountCallers(this); this.countCalls = new CountCalls(this); this.handlers = new Handlers(this); this.verifications = new Verifications(this); this.verifiers = new Verifiers(this); }
public EventAggregatorMock() { this.countCallers = new CountCallers(this); this.countCalls = new CountCalls(this); this.handlers = new Handlers(this); this.verifications = new Verifications(this); this.verifiers = new Verifiers(this); }
public NavigationServiceMock() { this.countCallers = new CountCallers(this); this.countCalls = new CountCalls(this); this.handlers = new Handlers(this); this.verifications = new Verifications(this); this.verifiers = new Verifiers(this); }
public AlbumLoader(IPhotosDbContext context, PlaceRegister placeRegister, string rootDirectory) { Verifiers.ArgNullVerify(!rootDirectory.IsNullOrEmpty(), nameof(rootDirectory)); Verifiers.Verify(Directory.Exists(rootDirectory), "Specified directory does not exist: {0}", rootDirectory); _context = context; _placeRegister = placeRegister; _rootDirectory = rootDirectory; }
public void Insert(TMonetaryAggregateShift entity) { using (var sqlConnection = _sqlConnectionProvider.OpenSqlConnection()) using (var sqlCommand = new SqlCommand(CreateInsertQuery(entity), sqlConnection)) { int rowsAffected = sqlCommand.ExecuteNonQuery(); Verifiers.Verify(rowsAffected == 1, "Money insertion failed"); } }
public void ListContains() { DefaultPrograms.WritePrograms(); DefaultPrograms obj = DefaultPrograms.programsList[0]; string text = obj.ProgramName; Assert.IsTrue(Verifiers.VerifyProgram(text)); }
/// <summary> /// 判断验证码。 /// </summary> /// <param name="key">当前唯一键。</param> /// <param name="code">验证码。</param> /// <returns>返回判断结果。</returns> protected virtual bool IsValidateCode(string key, string code) { if (string.IsNullOrEmpty(code) || !Request.Cookies.TryGetValue(key, out var value)) { return(false); } code = Verifiers.Hashed(code); return(string.Equals(value, code, StringComparison.OrdinalIgnoreCase)); }
public RePayments([NotNull] ILoan loan) { Verifiers.ArgNullVerify(loan, nameof(loan)); _loan = loan; _rePayments = new IRePayment[_loan.TotalPaymentsCount]; Calculate(); }
public void Delete(TMonetaryAggregateShift entity) { using (var connection = _sqlConnectionProvider.OpenSqlConnection()) using (var command = new SqlCommand(CreateDeleteQuery(entity), connection)) { int rowsAffected = command.ExecuteNonQuery(); Verifiers.Verify(rowsAffected == 1, "Money deletion failed"); } }
public AlbumCreator(IPhotosDbContext context, AlbumOverview photosOverview, PlaceRegister placeRegister, IEnumerable <IPhotoImage> photoImages) { Verifiers.ArgNullVerify(photosOverview, nameof(photosOverview)); _context = context; _photosOverview = photosOverview; _place = placeRegister.Register(_photosOverview.Place, _photosOverview.City, _photosOverview.Country); _photoImages = photoImages; }
public void OutOfRange() { string minValue = "0"; string maxValue = "121"; Verifiers.VerifyTimer(minValue); Verifiers.VerifyTimer(maxValue); Verifiers.VerifyPower(minValue); Verifiers.VerifyPower(maxValue); }
public void Remove(T element, int count) { Verifiers.Verify(_elements.ContainsKey(element) && _elements[element] >= count, "Not enough elements"); _elements[element] -= count; if (_elements[element] == 0) { _elements.Remove(element); } }
private void LoadCoins(MoneyCollection moneyCollection) { var coinLoader = new CoinRepository(_sqlConnectionProvider); foreach (var coinEntity in coinLoader.Load(moneyCollection.Currency)) { Verifiers.Verify(coinEntity.Count >= 0, "Coins count is less than zero: {0}", coinEntity.Count); moneyCollection.Coins.Add(coinEntity.Nominal, coinEntity.Count); } }
private void CreateRole(string roleName) { var role = new IdentityRole { Name = roleName }; var result = _roleManager.Create(role); Verifiers.Verify(result.Succeeded, "Failed to create role: {0}. Errors: {1}", roleName, result.Errors.ToJoinString()); _createdRoles.Add(role.Name); }
private void Create(ApplicationUser user, string password, params string[] roles) { var result = _userManager.Create(user, password); Verifiers.Verify(result.Succeeded, "Failed to create user: {0}. Errors: {1}", user.UserName, result.Errors.ToJoinString()); roles.ForEach(_roleCreator.EnsureRole); result = _userManager.AddToRoles(user.Id, roles); Verifiers.Verify(result.Succeeded, "Failed to add user '{0}' to roles '{1}'. Errors: {2}", user.UserName, roles, result.Errors.ToJoinString()); }
private void btnStart_Click(object sender, EventArgs e) { try { Verifiers.VerifyName(txbFood.Text); string path = ""; string food = txbFood.Text; if (FileIO.IsFile(txbFood.Text)) { path = txbFood.Text; food = FileIO.ReadFile(path); } Verifiers.VerifyTimer(txbTimer.Text); int timer = int.Parse(txbTimer.Text); int power = Verifiers.VerifyPower(txbPower.Text); txbPower.Text = power.ToString(); char character = Verifiers.VerifyChar(txbChar.Text); plate = new Plate(food, timer, power, character); if (path != "") { displayTimerCount = plate.Timer; timerDisplay.Start(); plate.StartCook(path); } else { displayTimerCount = plate.Timer; timerDisplay.Start(); plate.StartCook(); } } catch (CustomExceptions errorMessage) { MessageBox.Show(errorMessage.Message); } catch (FormatException errorMessage) { MessageBox.Show(errorMessage.Message); } catch (IOException errorMessage) { MessageBox.Show(errorMessage.Message); } catch (Exception errorMessage) { MessageBox.Show(errorMessage.Message); } }
public Loan(decimal netAmount, int totalPaymentsCount, /* LoanPeriodType periodType,*/ double annualInterestRate, [CanBeNull] IRounder rounder = null) { Verifiers.ArgVerify(netAmount > 0, "The amount of the loan can't be less or equal to 0", nameof(netAmount)); Verifiers.ArgVerify(totalPaymentsCount > 0, "The number of payments over the life of the loan can't be less or equal to 0", nameof(netAmount)); Verifiers.ArgVerify(annualInterestRate > 0, "(The Annual Percentage Rate can't be less or equal to 0", nameof(netAmount)); _netAmount = netAmount; TotalPaymentsCount = totalPaymentsCount; //_periodType = periodType; InterestRate = annualInterestRate / 100 / TotalPaymentsCount; _rounder = rounder ?? new DefaultRounder(); }
private static TMachineState CreateNewState <TMachineState>(IMachineStateOwner owner, params object[] args) where TMachineState : IMachineState { Type newStateType = typeof(TMachineState); object[] ctorArgs = new[] { owner }.Concat(args).ToArray(); Type[] ctorArgTypes = ctorArgs.Select(arg => arg.GetType()).ToArray(); ConstructorInfo ctor = newStateType.GetConstructor(ctorArgTypes); Verifiers.Assert(ctor != null, "No constructor with specified signature has been found: {0}", (object)(ctorArgTypes)); return((TMachineState)ctor.Invoke(ctorArgs)); }
public string GetAdminPassword() { Console.Write(EnterPasswordPrompt); string password = ReadPassword(); Console.WriteLine(); Console.Write(ConfirmPasswordPrompt); string confirmedPassword = ReadPassword(); Console.WriteLine(); Verifiers.Verify(string.Equals(password, confirmedPassword, StringComparison.Ordinal), "Failed to obtain admin password: Password is not accepted"); return(password); }
public DiskData[] GetDisks(string virtualMachineName) { EnsureConnected(); VmWareServiceUtil serviceUtil = new VmWareServiceUtil(_connection); ManagedObjectReference virtualMachineRef = serviceUtil.GetDecendentMoRef(null, "VirtualMachine", virtualMachineName); Verifiers.VerifyNotNull(virtualMachineRef, "Cannot find virtual machine with specified name: {0}", virtualMachineName); String dataCenterName = serviceUtil.GetDataCenter(virtualMachineRef); String[] vmDirectory = serviceUtil.GetVmDirectory(virtualMachineRef); var virtualDiskPaths = serviceUtil.GetVirtualDiskPaths(virtualMachineRef); return(new DiskData[0]); }
public IReadOnlyCollection <string> GetVirtualDiskPaths(ManagedObjectReference virtualMachineRef) { var virtualDiskPaths = new List <string>(); VirtualMachineConfigInfo virtualMachineConfig = (VirtualMachineConfigInfo)GetDynamicProperty(virtualMachineRef, "config"); Verifiers.VerifyNotNull(virtualMachineConfig, "Failed to obtain virtual machine configuration information"); VirtualDevice[] virtualDevices = virtualMachineConfig.hardware.device; foreach (VirtualDevice virtualDevice in virtualDevices) { if (virtualDevice is VirtualDisk) { VirtualDeviceFileBackingInfo backingInfo = (VirtualDeviceFileBackingInfo)virtualDevice.backing; virtualDiskPaths.Add(backingInfo.fileName); } } return(virtualDiskPaths); }