示例#1
0
        /*
         * Compare two CSV structures
         * Output to the differences to a new structure
         */
        public static ObjDataSet Diff(ObjDataSet A, ObjDataSet B, bool CaseSensitive)
        {
            ObjDataSet Output = new ObjDataSet();

            //Check the headers and create structure if they are the same
            if (A.GetHeaderCount() != B.GetHeaderCount())
            {
                return(null);
            }


            for (Int32 I = 0; I < A.GetHeaderCount(); I++)
            {
                String HA = A.GetHeaderName(I);
                String HB = B.GetHeaderName(I);

                if (!CaseSensitive)
                {
                    HA = HA.ToUpper();
                    HB = HB.ToUpper();
                }

                if (HA != HB)
                {
                    return(null);
                }

                else
                {
                    Output.AddHeader(A.GetHeaderName(I), null);
                }
            }


            for (Int32 I = 0; I < A.GetRowCount(); I++)
            {
                if (!B.Contains(A.GetRow(I), CaseSensitive))
                {
                    Output.Add(A.GetRow(I));
                }
            }

            return(Output);
        }