/// <summary> /// パスが指定したシナリオ形式とシナリオ格納形式のシナリオかどうか判定する /// </summary> /// <param name="path">シナリオのディレクトリ、またはアーカイブファイルの絶対パス</param> /// <param name="scenarioType">シナリオ形式。未指定またはAnyの場合はすべてのシナリオ形式が対象</param> /// <param name="containerType">シナリオ格納形式。未指定またはAnyの場合はすべてのシナリオ格納形式が対象</param> /// <returns>シナリオの場合true, シナリオでない場合false</returns> public static bool IsScenarioSummary(string path, ScenarioParameterType scenarioType = ScenarioParameterType.Any, ContainerParameterType containerType = ContainerParameterType.Any) { try { var scenarioSummary = GetScenarioSummary(path); if (scenarioType != ScenarioParameterType.Any) { var scenarioType2 = ConvertToScenarioType(scenarioType); if (scenarioType2 != scenarioSummary.ScenarioType) { return(false); } } if (containerType != ContainerParameterType.Any) { var containerType2 = ConvertToContainerType(containerType); if (containerType2 != scenarioSummary.ContainerType) { return(false); } } return(true); } catch (Exception) { return(false); } }
public void IsScenarioTest(string path, ScenarioParameterType scenarioParameterType, ContainerParameterType containerParameterType) { var fullName = Path.GetFullPath(Path.Combine(TestDirPath, "正常系/", path)); Assert.True(CardWirthScenario.IsScenarioSummary(fullName, scenarioParameterType, containerParameterType)); Assert.True(CardWirthScenario.IsScenarioSummary(fullName)); Assert.True(CardWirthScenario.IsScenarioSummary(fullName, ScenarioParameterType.Any, ContainerParameterType.Any)); }
/// <summary> /// <see cref="Enums.ScenarioParameterType"/>を<see cref="Enums.ScenarioType"/>に変換する /// </summary> /// <param name="scenarioParameterType">シナリオ形式</param> /// <returns></returns> private static ScenarioType ConvertToScenarioType(ScenarioParameterType scenarioParameterType) { return(Enum.TryParse(scenarioParameterType.ToString(), true, out ScenarioType convertedScenariotType) ? convertedScenariotType : ScenarioType.None); }
/// <summary> /// パスが指定したシナリオ形式のシナリオかどうか判定する /// </summary> /// <param name="path">シナリオのディレクトリ、またはアーカイブファイルの絶対パス</param> /// <param name="scenarioType">シナリオ形式</param> /// <returns>シナリオの場合true, シナリオでない場合false</returns> public static bool IsScenarioSummary(string path, ScenarioParameterType scenarioType) { return(IsScenarioSummary(path, scenarioType, ContainerParameterType.Any)); }