예제 #1
0
        public int CompareTo(object obj)
        {
            BreakPoint other = obj as BreakPoint;

            //same file?
            int result = File.CompareTo(other.File);

            if (result != 0)
            {
                return(result);
            }

            //same column?
            result = FileColumn.CompareTo(other.FileColumn);
            if (result != 0)
            {
                return(result);
            }

            //same line?
            result = FileLine.CompareTo(other.FileLine);
            if (result != 0)
            {
                return(result);
            }

            //same file, same column, same line: must be same breakpoint
            return(0);
        }
예제 #2
0
        public bool Check(string fileName)
        {
            using (var fileStream = FileWithBuffer.OpenRead(fileName, _fileBuffer))
            {
                FileLine previousLine    = FileLine.None;
                bool     firstLineReaden = false;
                foreach (var fileLine in new FileLineReader(fileStream, _streamBuffer))
                {
                    if (!_onlyCheckFormat && firstLineReaden)
                    {
                        if (previousLine.CompareTo(fileLine) > 0)
                        {
                            _logger.Warn($"File '{fileName}' is not properly sorted.");
                            _logger.Warn($"Line '{fileLine}' should be before line '{previousLine}'.");
                            return(false);
                        }
                    }

                    previousLine    = fileLine;
                    firstLineReaden = true;
                }

                return(true);
            }
        }
예제 #3
0
        public int CompareTo(object obj)
        {
            var other = obj as BreakPoint;

            if (File == null && other == null)
            {
                return(1);
            }

            //same file?
            var result = string.Compare(File, other.File, StringComparison.OrdinalIgnoreCase);

            if (result != 0)
            {
                return(result);
            }

            //same column?
            result = FileColumn.CompareTo(other.FileColumn);
            if (result != 0)
            {
                return(result);
            }

            //same line?
            result = FileLine.CompareTo(other.FileLine);
            if (result != 0)
            {
                return(result);
            }

            //same file, same column, same line: must be same breakpoint
            return(0);
        }