コード例 #1
0
ファイル: InfoProvider.cs プロジェクト: spottedmahn/Id3
        /// <summary>
        ///
        /// </summary>
        /// <param name="inputs"></param>
        /// <returns></returns>
        /// <exception cref="InfoProviderException">Thrown on any unhandled error.</exception>
        public Id3Tag[] GetInfo(InfoProviderInputs inputs)
        {
            try
            {
                Inputs = inputs ?? new InfoProviderInputs();
                if (!MeetsInputCriteria())
                {
                    throw new InfoProviderException("Required inputs do not meet the criteria of the info provider.");
                }

                Id3Tag[] result = GetTagInfo();
                return(result);
            }
            catch (InfoProviderException)
            {
                throw;
            }
            catch (TargetInvocationException ex) when(ex.InnerException != null)
            {
                throw new InfoProviderException(ex.InnerException.Message, ex.InnerException);
            }
            catch (Exception ex)
            {
                throw new InfoProviderException(ex.Message, ex);
            }
        }
コード例 #2
0
ファイル: InfoProvider.cs プロジェクト: spottedmahn/Id3
 public InfoProviderException TryGetInfo(InfoProviderInputs inputs, out Id3Tag[] resultTags)
 {
     try
     {
         resultTags = GetInfo(inputs);
         return(null);
     }
     catch (InfoProviderException ex)
     {
         resultTags = null;
         return(ex);
     }
 }