Exemple #1
0
        public CsvEntry Clone()
        {
            string[] array = (string[])strings.ToArray().Clone();

            CsvEntry e = new CsvEntry(array);

            return(e);
        }
Exemple #2
0
        void init(Buf data, Encoding encoding)
        {
            if (encoding == null)
            {
                encoding = defaultEncoding;
            }

            int      bomSize = 0;
            Encoding enc2    = null;

            if (data != null)
            {
                enc2 = Str.CheckBOM(data.ByteData, out bomSize);
            }
            if (bomSize >= 1)
            {
                data = new Buf(Util.RemoveStartByteArray(data.ByteData, bomSize));
            }
            if (enc2 != null)
            {
                encoding = enc2;
            }
            this.encoding = encoding;

            entryList = new List <CsvEntry>();

            if (data != null)
            {
                MemoryStream ms = new MemoryStream(data.ByteData);
                StreamReader sr = new StreamReader(ms, this.encoding);

                while (true)
                {
                    string s = sr.ReadLine();

                    if (s == null)
                    {
                        break;
                    }

                    char[]   sep     = { ',' };
                    string[] strings = s.Trim().Split(sep, StringSplitOptions.None);

                    CsvEntry e = new CsvEntry(strings);
                    Add(e);
                }
            }
        }
        public MailUser(CsvEntry e)
        {
            this.MailAddress = e[0];
            this.Company     = e[1];
            this.FullName    = e[2];
            this.Language    = CoreLanguageList.GetLanguageClassByName(e[3]);

            if (e.Count >= 5)
            {
                string pStr = e[4];

                this.ParamList = MailUtil.StrToParamList(pStr);
            }

            normalize();
        }
Exemple #4
0
        int sortInternal(CsvEntry e1, CsvEntry e2)
        {
            if (csvCompareMethod != null)
            {
                object o1 = e1.Convert(csvCompareType, csvCompareIndex);
                object o2 = e2.Convert(csvCompareType, csvCompareIndex);

                return(csvCompareMethod(o1, o2) * (csvCompareReverse ? -1 : 1));
            }
            else
            {
                IComparable o1 = (IComparable)e1.Convert(csvCompareType, csvCompareIndex);
                IComparable o2 = (IComparable)e2.Convert(csvCompareType, csvCompareIndex);

                return(o1.CompareTo(o2) * (csvCompareReverse ? -1 : 1));
            }
        }
        public CsvEntry ToCsvEntry()
        {
            CsvEntry e = new CsvEntry(this.MailAddress, this.Company, this.FullName, this.Language.Name, MailUtil.ParamListToStr(this.ParamList));

            return(e);
        }
Exemple #6
0
 public void Add(CsvEntry e)
 {
     entryList.Add(e);
 }