コード例 #1
0
ファイル: EDIUtil.cs プロジェクト: alcardac/SDMXRI_WS_OF
        /// <summary>
        /// Checks the prefix is as expected
        /// <p />
        /// If the prefix is not as expected and <paramref name="errorOnFail"/> is set to true, an exception will be thrown
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <param name="prefix">The prefix.</param>
        /// <param name="errorOnFail">if set to <c>true</c> will throw an exception on fail.</param>
        /// <returns>true if it the prefix is as expected; otherwise false.</returns>
        /// <exception cref="System.ArgumentException">Expecting prefix : ' <c> prefix.GetPrefix() </c> ' but got ' <c> dataReader.LineType </c> '</exception>
        public static bool AssertPrefix(IEdiReader dataReader, EdiPrefix prefix, bool errorOnFail)
        {
            if (dataReader.LineType != prefix)
            {
                if (errorOnFail)
                {
                    throw new ArgumentException("Expecting prefix : '" + prefix.GetPrefix() + "' but got '" + dataReader.LineType + "'");
                }

                return false;
            }

            return true;
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EDIStructureParserEngine"/> class.
 /// </summary>
 /// <param name="sourceData">
 /// The source data.
 /// </param>
 public EDIStructureParserEngine(IReadableDataLocation sourceData)
 {
     this._ediReader = new EdiReader(sourceData);
     this._twoLetterIsoLanguageName = CultureInfo.GetCultureInfo("en").TwoLetterISOLanguageName;
 }