public override ExtractStatus Extract(TextFileReader reader)
        {
            string valueString = null;

            try
            {
                valueString = reader.GetCSVFieldValue(this.ColumnNo);
                this.Value  = this.FieldType.ConvertFromString(valueString);
            }
            catch (Exception exc)
            {
                throw new Exception(this.FieldInfo + ": \"" + valueString + "\": " + exc.ToString());
            }

            ExtractStatus r = ExtractStatus.Success;

            if (null == this.InstanceCreator)
            {
                if (this.Value.Equals(SignatureValue))
                {
                    this.Target = new T();
                    r           = ExtractStatus.Success;
                }
                else
                {
                    r = ExtractStatus.ValueMismatched;
                }
            }
            else
            {
                this.Target = this.InstanceCreator(this, this.Value);
            }
            return(r);
        }
コード例 #2
0
        public override ExtractStatus Extract(TextFileReader reader)
        {
            string valueString = null;

            try
            {
                valueString = reader.GetCSVFieldValue(this.ColumnNo);
                this.Value  = this.FieldType.ConvertFromString(valueString);
                return(null == this.PropertySetter ? ExtractStatus.Success : this.PropertySetter(this, this.Target, this.Value));
            }
            catch (Exception exc)
            {
                throw new Exception(this.FieldInfo + ": \"" + valueString + "\" : " + exc.ToString());
            }
        }