public override bool IsValid(object o, ref ReasonList reasons, params object[] additionalArgs) { base.IsValid(o, ref reasons, additionalArgs); if (!(o is string)) { throw new ArgumentException("CERootPathValidationRule was called without using a string."); } ResetRequiredFolders(); m_sPathToCheck = o as string; var pathValidationRule = new CEPathValidationRule(true, true); pathValidationRule.IsValid(m_sPathToCheck, ref m_reasons); // If the path itself is faulty we cannot check the contents if (!m_reasons.ContainsError) { CheckFolders(); } reasons = m_reasons; return(!m_reasons.ContainsError); }
private void CheckName() { //Must not be empty if (string.IsNullOrWhiteSpace(m_sPathToCheck)) { m_reasons.Add(new Reason() { HumanReadableExplanation = Properties.ValidationReasons.CEGameNameIsEmpty, Severity = EReasonSeverity.eRS_error, ReasonType = EReason.eR_CheckGameNameEmpty }); return; } // The name is valid m_pathValidationRule.IsValid(m_sPathToCheck, ref m_reasons); if (IsPath()) { var r = new Reason() { HumanReadableExplanation = Properties.ValidationReasons.CEGameNameIsPath, Severity = EReasonSeverity.eRS_error, ReasonType = EReason.eR_CheckGameNameIsPath }; r.HumanReadableSolutions.Add(Properties.ValidationReasons.SolGameNameIsPath); m_reasons.Add(r); } else { string sCorrectedRoot = OmgUtils.Path.PathUtils.CheckFolderPath(m_sCERootPath); string sFullGamePath = OmgUtils.Path.PathUtils.CheckFolderPath(sCorrectedRoot += m_sPathToCheck); if (!Directory.Exists(sFullGamePath)) { var r = new Reason() { HumanReadableExplanation = Properties.ValidationReasons.CEGameNotExist, Severity = EReasonSeverity.eRS_warning, ReasonType = EReason.eR_CheckGamePathNotExist }; r.HumanReadableSolutions.Add(Properties.ValidationReasons.SolCEGameNotExist); m_reasons.Add(r); } } }