Exemplo n.º 1
0
        public static FileRow operator +(FileRow fileRow1, FileRow fileRow2)
        {
            FileRow resultFileRow = new FileRow()
            {
                IP = fileRow1.IP, Values = fileRow1.Values + fileRow2.Values
            };

            resultFileRow.Values.Values = resultFileRow.Values.Values.Distinct().OrderBy(val => Convert.ToInt32(val)).ToList();

            return(resultFileRow);
        }
Exemplo n.º 2
0
        public DataFile(List <string> fileRead)
        {
            List <FileRow> fileRows = new List <FileRow>();

            for (int i = 0; i < fileRead.Count; i++)
            {
                FileRow fileRow = new FileRow
                {
                    IP = fileRead[i].Substring(0, 7)
                };

                fileRow.Values.Values = fileRead[i].Substring(9, fileRead[i].Length - 9).Split(',').Distinct().OrderBy(val => Convert.ToInt32(val)).ToList();

                fileRows.Add(fileRow);
            }

            FileRows = fileRows;
        }
Exemplo n.º 3
0
        public override bool Equals(object obj)
        {
            FileRow fileRow = (FileRow)obj;
            bool    IPEqual = fileRow.IP.Equals(IP);

            int valuesEqual = 0;

            foreach (string value in fileRow.Values.Values)
            {
                if (Values.Values.Any(val => val.Equals(value)))
                {
                    valuesEqual++;
                }
            }

            if (IPEqual && valuesEqual == fileRow.Values.Values.Count && valuesEqual == Values.Values.Count)
            {
                return(true);
            }

            return(false);
        }