/// <summary> /// Helper method for setting a configuration parameter. /// </summary> /// <returns><c>true</c> if the API call returned success, <c>false</c> otherwise.</returns> /// <param name="apiCall">The API call to perform.</param> /// <param name="key">The key of the configuration parameter to set.</param> /// <param name="value">The value to set the configuration key to.</param> /// <param name="tangoMethodName">Name of the calling method. Used for logging purposes.</param> /// <typeparam name="T">The type of object to set.</typeparam> private bool _ConfigHelperSet <T>(ConfigAPISetter <T> apiCall, string key, T value, string tangoMethodName) { if (m_configHandle == IntPtr.Zero) { Debug.Log(string.Format(m_ConfigErrorFormat, CLASS_NAME, tangoMethodName)); return(false); } bool wasSuccess = false; wasSuccess = apiCall(m_configHandle, key, value) == Common.ErrorType.TANGO_SUCCESS; if (!wasSuccess) { Debug.Log(string.Format(m_ErrorLogFormat, CLASS_NAME, tangoMethodName, key, value)); } return(wasSuccess); }
/// <summary> /// Helper method for setting a configuration parameter. /// </summary> /// <returns><c>true</c> if the API call returned success, <c>false</c> otherwise.</returns> /// <param name="apiCall">The API call to perform.</param> /// <param name="key">The key of the configuration parameter to set.</param> /// <param name="value">The value to set the configuration key to.</param> /// <param name="tangoMethodName">Name of the calling method. Used for logging purposes.</param> /// <typeparam name="T">The type of object to set.</typeparam> private bool _ConfigHelperSet <T>(ConfigAPISetter <T> apiCall, string key, T value, string tangoMethodName) { #if UNITY_EDITOR return(true); #else if (m_configHandle == IntPtr.Zero) { Debug.Log(string.Format(m_ConfigErrorFormat, CLASS_NAME, tangoMethodName)); return(false); } bool wasSuccess = false; wasSuccess = apiCall(m_configHandle, key, value) == Common.ErrorType.TANGO_SUCCESS; if (!wasSuccess) { Debug.Log(string.Format("{0}.{1}() Was unable to set key: {2} with value: {3}", CLASS_NAME, tangoMethodName, key, value)); } return(wasSuccess); #endif }