コード例 #1
0
        public void SetValue(string fieldName, object val)
        {
            if (mLineValues == null)
            {
                mLineValues = new object[mFields.Count];
            }
            if (mSortedList == null)
            {
                mSortedList = mFields.GetSortedList();
            }

            mLineValues[mFields[fieldName].Index] = val;
        }
コード例 #2
0
        private System.Text.RegularExpressions.Regex CreateLineRegExp()
        {
            //esempio: @"^(?<colA>.{6})(?<colB>.{8})(?<colC>.+)$"
            // * Specifies zero or more matches; for example, \w* or (abc)*. Equivalent to {0,}.
            // + Specifies one or more matches; for example, \w+ or (abc)+. Equivalent to {1,}.

            IField[] fields = mFields.GetSortedList();

            string pattern = "^";

            for (int i = 0; i < fields.Length; i++)
            {
                pattern += fields[i].RegularExpressionPattern;
                pattern += Utilities.ValidateRegExpSeparator(Separator);
            }
            //pattern += "$"; //commettato per non cercare necessariamente la fine riga, che quindi necessitava di specificare tutti i campi precisi.

            return(new System.Text.RegularExpressions.Regex(pattern, System.Text.RegularExpressions.RegexOptions.Compiled | System.Text.RegularExpressions.RegexOptions.Singleline));
        }