Exemplo n.º 1
0
        /// <summary>
        /// Compares two DbaseField instances to determine if they describe the
        /// same field.
        /// </summary>
        /// <param name="other">The field to compare to.</param>
        /// <returns>True if the fields are equal, false otherwise.</returns>
        public Boolean Equals(DbaseField other)
        {
            if (ReferenceEquals(other, null))
            {
                return(false);
            }

            CompareInfo compare = DbaseLocaleRegistry.GetCulture(_header.LanguageDriver).CompareInfo;

            return(compare.Compare(other.ColumnName, ColumnName, CompareOptions.IgnoreCase) == 0 &&
                   other.DataType == DataType &&
                   other.Length == Length &&
                   other.Decimals == Decimals);
        }
Exemplo n.º 2
0
        internal static DbaseFile CreateDbaseFile(String fileName, DataTable schema, CultureInfo culture, Encoding encoding, IGeometryFactory geoFactory)
        {
            DbaseFile file = new DbaseFile(fileName, geoFactory, false);
            Byte      languageDriverCode = DbaseLocaleRegistry.GetLanguageDriverCode(culture, encoding);

            file._header = new DbaseHeader(languageDriverCode, DateTime.Now, 0);

            file._header.Columns = new List <DbaseField>(DbaseSchema.GetFields(schema, file._header));
            file._headerIsParsed = true;
            file.Open(WriteAccess.Exclusive);
            file.Save();
            file.Close();

            return(file);
        }