/// <summary> /// Retrieves available analyze options for specified research type and model type. /// </summary> /// <param name="rt">Research type.</param> /// <param name="mt">Model type.</param> /// <returns>Available analyze options.</returns> /// <note>Analyze option is available for research, if it is available /// both for research type and model type.</note> public static AnalyzeOption GetAvailableAnalyzeOptions(ResearchType rt, ModelType mt) { ResearchTypeInfo[] rInfo = (ResearchTypeInfo[])rt.GetType().GetField(rt.ToString()).GetCustomAttributes(typeof(ResearchTypeInfo), false); Type researchType = Type.GetType(rInfo[0].Implementation, true); AvailableAnalyzeOption rAvailableOptions = ((AvailableAnalyzeOption[])researchType.GetCustomAttributes(typeof(AvailableAnalyzeOption), true))[0]; ModelTypeInfo[] mInfo = (ModelTypeInfo[])mt.GetType().GetField(mt.ToString()).GetCustomAttributes(typeof(ModelTypeInfo), false); Type modelType = Type.GetType(mInfo[0].Implementation, true); AvailableAnalyzeOption mAvailableOptions = ((AvailableAnalyzeOption[])modelType.GetCustomAttributes(typeof(AvailableAnalyzeOption), true))[0]; return(rAvailableOptions.Options & mAvailableOptions.Options); }
/// <summary> /// Gets available analyze options for specified research. /// </summary> /// <param name="id">ID of research.</param> /// <returns>Available analyze options.</returns> /// <note>Analyze option is available for research, if it is available /// both for research type and model type.</note> public static AnalyzeOption GetAvailableAnalyzeOptions(Guid id) { try { AvailableAnalyzeOption rAvailableOptions = ((AvailableAnalyzeOption[])existingResearches[id].GetType().GetCustomAttributes(typeof(AvailableAnalyzeOption), true))[0]; ModelType t = existingResearches[id].ModelType; ModelTypeInfo[] info = (ModelTypeInfo[])t.GetType().GetField(t.ToString()).GetCustomAttributes(typeof(ModelTypeInfo), false); Type mt = Type.GetType(info[0].Implementation, true); AvailableAnalyzeOption mAvailableOptions = ((AvailableAnalyzeOption[])mt.GetCustomAttributes(typeof(AvailableAnalyzeOption), true))[0]; return(rAvailableOptions.Options & mAvailableOptions.Options); } catch (KeyNotFoundException) { throw new CoreException("Specified research does not exists."); } }