public BoardWrapper(string[][] newBoard = null, int size = 19) { if (newBoard != null) { ValidationMethods.ValidateBoard(newBoard, size); } _size = size; _board = new Board(newBoard, size); }
public override bool IsValid(object?value) { if (value == null) { return(CanBeNull); } return(value is string text && ValidationMethods.IsYear(text)); }
private void InitControls() { _psdFile = new PsdFileVM(); _psdFileSection = new PsdFileSectionVM(); _validationMethods = new ValidationMethods(); _validationMethods.Reset(); InitGrid(dataGridView1); InitGrid(gridValidCode); InitGrid(gridErrorMsg); dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; gridValidCode.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; gridErrorMsg.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; dataGridView1.DataSource = _validationMethods.DSPsdLayerVMList; gridValidCode.DataSource = _validationMethods.DsValidCodeList; gridErrorMsg.DataSource = _validationMethods.DsErrorMsgList; var columnName = string.Empty; { columnName = Masco.Core.Helper.Refrection.GetPropName <ValidateVM>(x => x.INDEX); gridValidCode.Columns[columnName].Width = 60; columnName = Masco.Core.Helper.Refrection.GetPropName <ValidateVM>(x => x.CODE); gridValidCode.Columns[columnName].Width = 60; columnName = Masco.Core.Helper.Refrection.GetPropName <ValidateVM>(x => x.CHECK); gridValidCode.Columns[columnName].Width = 60; columnName = Masco.Core.Helper.Refrection.GetPropName <ValidateVM>(x => x.TITLE); gridValidCode.Columns[columnName].Width = 200; columnName = Masco.Core.Helper.Refrection.GetPropName <ValidateVM>(x => x.ResultState); gridValidCode.Columns[columnName].Width = 80; } // ILS 검증부분 이벤트 추가 및 새로 생성 _fullValidCodeList = new List <ValidateVM>(); var v = new Validate1(); _fullValidCodeList = v.GetList(); // radio btn 이벤트 추가 rbtn1.CheckedChanged += rbtnLSType_CheckedChanged; rbtn2.CheckedChanged += rbtnLSType_CheckedChanged; rbtn3.CheckedChanged += rbtnLSType_CheckedChanged; rbtn4.CheckedChanged += rbtnLSType_CheckedChanged; rbtn5.CheckedChanged += rbtnLSType_CheckedChanged; rbtn6.CheckedChanged += rbtnLSType_CheckedChanged; rbtn7.CheckedChanged += rbtnLSType_CheckedChanged; rbtn8.CheckedChanged += rbtnLSType_CheckedChanged; // rdoAll.CheckedChanged += rdoILSTypeAll_CheckedChanged; }
public override ValidationResult Validate(object value, CultureInfo cultureInfo) { string letter = value as string; if (!ValidationMethods.ValidateNumber(letter)) { return(new ValidationResult(false, $"Solo un numero")); } return(new ValidationResult(true, null)); }
public string Register(string name, string aiType = "human") { ValidationMethods.ValidateAIType(aiType); _players_set++; if (_players_set > 2) { throw new WrapperException("Protocols of interaction violation in RefereeWrapper: Cannot register more than two players"); } return(_referee.Register(name, aiType)); }
private void BtnEnterPatient_Click(object sender, EventArgs e) { //reset textboxes ValidationMethods.ClearTextBoxes(this.Controls); cmbxCategory.DataSource = Category.getCategories_DropDownList(); //add enter time /*0 patient id,1 patient name,2 reserve time,3 reception time,4 current visit notes,5 category name,*/ //show details of patient DoctorsLogic.EnterPatient(listbxWaitingQueue, txtPatientID, txtPatientName, dtpReserveTime, dtpReceptionTime, txtCurrentVisitNotes, cmbxCategory); }
//End Application Settings public override bool Execute() { ValidationMethods.ValidateStringParameter("SqlServer", SqlServer); ValidationMethods.ValidateStringParameter("Database", Database); ValidationMethods.ValidateStringParameter("LogDestinationPath", LogDestinationPath); if (!PreCheck()) { MSForms.MessageBox.Show("Log Parser 2.2 required."); Process.Start(logParserDownloadLink); Utility.MyLogMessage(this, "Log Parser 2.2 required.", MessageImportance.High); return(true); } _beginTimestamp = DateTime.Now; if (Capture_SqlSnaps) { InitiateSqlSnap(); } if (Capture_SOAPLogs) { InitiateSOAPLog(); } MSForms.DialogResult dialogResult = MSForms.MessageBox.Show("Running tests...\r\nPlease press OK to finish collecting data.", "Please press OK to finish collecting data.", MSForms.MessageBoxButtons.OK); if (dialogResult == MSForms.DialogResult.OK) { _endTimestamp = DateTime.Now; _completedLogPath = LogDestinationPath + _beginTimestamp.ToString("MMddyyyy-HHmmss") + "-" + _endTimestamp.ToString("MMddyyyy-HHmmss"); Directory.CreateDirectory(_completedLogPath); if (Capture_SqlSnaps) { CleanSqlSnap(); } if (Capture_IISLogs) { CleanupIISLog(); } if (Capture_SOAPLogs) { CleanupSOAPLog(); } if (Capture_EventLogs) { CleanupEventLog(); } } return(true); }
public string Register(string name, string aiType, int n = 1) { ValidationMethods.ValidateAIType(aiType); ValidationMethods.ValidateN(n); if (_register_flag) { throw new WrapperException("Protocols of interaction violation in PlayerWrapper: ReceiveStones called twice"); } _register_flag = true; return(_player.Register(name, aiType, n)); }
public void ValidPhoneNumberTest() { //test 1: invalid, input is a string literal with no numbers Assert.AreEqual(false, ValidationMethods.ValidPhoneNumber("Hello, World")); //test 2: invalid, input is too long to be a phone number Assert.AreEqual(false, ValidationMethods.ValidPhoneNumber("012345678901")); //test 3: valid, input is a correctly formatted phone number Assert.AreEqual(true, ValidationMethods.ValidPhoneNumber("01234567890")); }
public void ValidateProperty(string propertyName) { if (ValidationMethods.TryGetValue(propertyName, out ValidateMethod? validationMethod)) { ClearErrors(propertyName); validationMethod(ErrorsByPropertyName[propertyName]); OnErrorsChanged(propertyName); } }
public void IsNumericTest() { //first test is an invalid input bool firstResult = ValidationMethods.IsNumeric("Hello, World!"); Assert.AreEqual(false, firstResult); //second test is a valid input bool secondResult = ValidationMethods.IsNumeric("22"); Assert.AreEqual(true, secondResult); }
/* * Simulates a game between two players * Returns a list off victors * Players can be local or remote * If a remote player sends illegal data or disconnects, the other player is declared victor */ public List <string> RefereeGame() { while (true) { try { string next_move = _current_player.MakeAMove(GetBoardHistory()); if (next_move == "pass") { Pass(); } else { //maybe this function shouldn't be in referee... need to check if this is a valid point b/c no wrappeer ValidationMethods.ValidatePoint(next_move, _size); Play(next_move); } //Don't Update current player!!! already updated in Pass() and Play() //_current_player = _current_player == _player1 ? _player2 : _player1; } catch (RefereeException) { List <PlayerWrapper> victors = GetVictors(); List <string> names = new List <string>(); foreach (PlayerWrapper victor in victors) { names.Add(victor.GetName()); } return(names); } catch (Exception e) { if (e is JsonSerializationException || e is ArgumentException || e is SocketException || e is WrapperException || e is JsonReaderException) { List <string> names = new List <string>(); if (_current_player == _player1) { names.Add(_player2.GetName()); } else { names.Add(_player1.GetName()); } return(names); } else { throw; } } } }
public void ValidateProperty(string propertyName) { if (ValidationMethods.ContainsKey(propertyName)) { ClearErrors(propertyName); var method = ValidationMethods[propertyName]; method(ErrorsByPropertyName[propertyName]); OnErrorsChanged(propertyName); } }
public string MakeAMove(string[][][] boards) { ValidationMethods.ValidateBoards(boards); if (!_register_flag) { throw new WrapperException("Protocols of interaction violation in PlayerWrapper: Register not called before MakeAMove"); } if (!_receive_stones_flag) { throw new WrapperException("Protocols of interaction violation in PlayerWrapper: ReceiveStones not called before MakeAMove"); } return(_player.MakeAMove(boards)); }
public void ValidateProperty(string propertyName) { if (ValidationMethods.TryGetValue(propertyName, out ValidateMethod? validationMethod) && ErrorsByPropertyName.TryGetValue(propertyName, out ErrorDescriptors? currentErrors)) { // Copy the current errors. var previousErrors = currentErrors.ToList(); // Validate. validationMethod(currentErrors); // Clear obsoleted errors and notify properties that changed. UpdateAndNotify(currentErrors, previousErrors, propertyName); } }
public void HasInputTest() { //test 1: invalid, input is null Assert.AreEqual(false, ValidationMethods.HasInput(null)); //test 2: invalid, input is nothing Assert.AreEqual(false, ValidationMethods.HasInput("")); //test 3: invalid, input is nothing but spaces Assert.AreEqual(false, ValidationMethods.HasInput(" ")); //test 4: valid, input is a valid string input Assert.AreEqual(true, ValidationMethods.HasInput("Hello, World!")); }
public static string?NotPassword(string?password, string paramName, bool canBeNull) { if (canBeNull && password == null) { return(password); } if (!ValidationMethods.IsPassword(password)) { throw new ArgumentException($"Parameter:{ paramName}"); } return(password); }
public static string?NotPassword([ValidatedNotNull] string?password, string paramName, bool canBeNull) { if (canBeNull && password == null) { return(password); } if (!ValidationMethods.IsPassword(password)) { throw new ArgumentException(HB.Framework.Common.Properties.Resources.NotPasswordErrorMessage, paramName); } return(password); }
public void ReceiveStones(string stone) { ValidationMethods.ValidateStone(stone); if (!_register_flag) { throw new WrapperException("Protocols of interaction violation in PlayerWrapper: Register not called before ReceiveStones"); } if (_receive_stones_flag) { throw new WrapperException("Protocols of interaction violation in PlayerWrapper: Receive stone called twice on a non-touornament player"); } _player.ReceiveStones(stone); _receive_stones_flag = true; }
public IEnumerator ValidationMethods_HasDirtyScenes() { Scene s = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene); yield return(null); bool dirty = ValidationMethods.HasDirtyScenes(); Assert.IsFalse(dirty); EditorSceneManager.MarkSceneDirty(s); dirty = ValidationMethods.HasDirtyScenes(); Assert.IsTrue(dirty); }
private void BtnSave_Click(object sender, EventArgs e) { if (chkEnableScanTime.Checked) { Doctor_RegisterVisit_Out(txtPatientName.Text, txtNextVisitNotes.Text, txtCurrentVisitNotes.Text, dtpScanTime.Value.ToString("yyyy-MM-dd")); } else { Doctor_RegisterVisit_Out(txtPatientName.Text, txtNextVisitNotes.Text, txtCurrentVisitNotes.Text, null); } DoctorsLogic.PopulateListBox(listbxWaitingQueue); /*************saving picture****************/ /*************saving picture****************/ ValidationMethods.ClearTextBoxes(this.Controls); }
/// <inheritdoc /> public ReturnCode Run() { Dictionary <GUID, List <GUID> > assetToReferences = new Dictionary <GUID, List <GUID> >(); HashSet <GUID> customAssets = new HashSet <GUID>(); #if UNITY_2019_3_OR_NEWER if (m_CustomAssets != null) { customAssets.UnionWith(m_CustomAssets.Assets); } #endif // Pack each asset bundle foreach (var bundle in m_BuildContent.BundleLayout) { if (ValidAssetBundle(bundle.Value, customAssets)) { PackAssetBundle(bundle.Key, bundle.Value, assetToReferences); } else if (ValidationMethods.ValidSceneBundle(bundle.Value)) { PackSceneBundle(bundle.Key, bundle.Value, assetToReferences); } } // Calculate Asset file load dependency list foreach (var bundle in m_BuildContent.BundleLayout) { foreach (var asset in bundle.Value) { List <string> files = m_WriteData.AssetToFiles[asset]; List <GUID> references = assetToReferences[asset]; foreach (var reference in references) { List <string> referenceFiles = m_WriteData.AssetToFiles[reference]; if (!files.Contains(referenceFiles[0])) { files.Add(referenceFiles[0]); } } } } return(ReturnCode.Success); }
private void BtnNewReservation_Click(object sender, EventArgs e) { ValidationMethods.Enable_DisableTextBoxes(new List <TextBox>() { txtPatientID, txtPatientName, txtPatientPhone }, true); ValidationMethods.ClearTextBoxes(new List <TextBox>() { txtPatientID, txtPatientName, txtPatientPhone }); cmbxVisitType.SelectedIndex = 0; ValidationMethods.ClearCheckedListBoxSelection(clbAdditionalServices); ValidationMethods.ClearTextBoxesNumbers(new List <TextBox>() { txtDiscount, txtPayed, txtRemaining }); VisitsLogic.CalculateTotalRequired(cmbxVisitType, txtTotal, clbAdditionalServices); }
public void ValidateProperty(string propertyName, bool clear = false) { if (ValidationMethods.TryGetValue(propertyName, out ValidateMethod? validationMethod)) { var currentErrors = ErrorsByPropertyName[propertyName]; // Copy the current errors. var previousErrors = currentErrors.ToList(); if (!clear) { // Validate. validationMethod(currentErrors); } // Clear obsoleted errors and notify properties that changed. UpdateAndNotify(currentErrors, previousErrors, propertyName); } }
#pragma warning restore 649 public ReturnCode Run() { foreach (var bundlePair in m_BuildContent.BundleLayout) { if (ValidationMethods.ValidAssetBundle(bundlePair.Value)) { // Use generated internalName here as we could have an empty asset bundle used for raw object storage (See CreateStandardShadersBundle) var internalName = string.Format(CommonStrings.AssetBundleNameFormat, m_PackingMethod.GenerateInternalFileName(bundlePair.Key)); CreateAssetBundleCommand(bundlePair.Key, internalName, bundlePair.Value); } else if (ValidationMethods.ValidSceneBundle(bundlePair.Value)) { CreateSceneBundleCommand(bundlePair.Key, m_WriteData.AssetToFiles[bundlePair.Value[0]][0], bundlePair.Value[0], bundlePair.Value); for (int i = 1; i < bundlePair.Value.Count; ++i) { CreateSceneDataCommand(m_WriteData.AssetToFiles[bundlePair.Value[i]][0], bundlePair.Value[i]); } } } return(ReturnCode.Success); }
public static string?NotLoginName(string?loginName, string paramName, bool canBeNull) { if (loginName == null) { if (canBeNull) { return(null); } else { throw new ArgumentNullException(paramName); } } if (!ValidationMethods.IsLoginName(loginName)) { throw new ArgumentException($"Parameter:{ paramName}"); } return(loginName); }
public static string?NotEmail(string?email, string paramName, bool canBeNull) { if (email == null) { if (canBeNull) { return(null); } else { throw new ArgumentNullException($"Parameter:{ paramName}"); } } if (!ValidationMethods.IsEmail(email)) { throw new ArgumentException($"Parameter:{ paramName}"); } return(email); }
public static string?NotMobile(string?mobile, string paramName, bool canBeNull) { if (mobile == null) { if (canBeNull) { return(null); } else { throw new ArgumentNullException(paramName); } } if (!ValidationMethods.IsMobilePhone(mobile)) { throw new ArgumentException($"Parameter:{ paramName}"); } return(mobile); }
public string this[string columnName] { get { var error = string.Empty; switch (columnName) { case "Email": if (Email == null) { error = "Enter your e-mail"; } else if (!ValidationMethods.EmailValidation(Email)) { error = "Enter correct e-mail"; } break; } return(error); } }
//internal static async Task<ICollection<string>> BuildOrderedCollection(IElement item) //{ // return await BuildOrderedCollection((object) item); //} //internal static async Task<ICollection<string>> BuildOrderedCollection(IGenericRootItem item) //{ // return await BuildOrderedCollection((object) item); //} internal static async Task <ICollection <string> > BuildOrderedCollection(IElement item) { if (item == null) { return(null); } var orderedDataModels = await ConvertPropertyInfoToValidationModelsAsync(item); var orderedData = new ReadOnlyCollection <IPropertyValidation>(orderedDataModels.FilterNoOrder().FilterIgnored().ToList()); if (!await ValidationMethods.ValidateObject(orderedData)) { return(null); } var collection = new Collection <string>(); // Add required and optional values based on Build Order foreach (var dataModel in orderedData) { if (!dataModel.IsRequired && dataModel.Value == null) { continue; } if (dataModel.IsCollection && dataModel.GetType() == typeof(Collection <string>)) { var value = (Collection <string>)dataModel.Value; collection.Add(value.ToRepeatString()); } else { collection.Add(dataModel.Value.ToString()); } } return(collection); }