예제 #1
0
        static (VbpLine, Comparison) FindLine(VbpLine queryLine, Vbp targetVbp)
        {
            var searchSpace = targetVbp.Lines.Where(targetLine => (!targetLine.processed) && (targetLine.Section == queryLine.Section));

            foreach (var targetLine in searchSpace)
            {
                var comparison = queryLine.Compare(targetLine);

                if (comparison != Comparison.different)
                {
                    return(targetLine, comparison);
                }
            }
            return(null, Comparison.different);
        }
예제 #2
0
        internal Comparison Compare(VbpLine them)
        {
            if (them.Line == this.Line)
            {
                return(Comparison.equal);
            }

            if (them.Section != this.Section)
            {
                return(Comparison.different);
            }

            switch (this.Section)
            {
            case "Object":
            case "Reference":
                //System.Diagnostics.Debug.WriteLine("{0}\n{1}", this._content, them._content);
                if (them._contentSplit[1] != this._contentSplit[1])
                {
                    return(Comparison.different);
                }
                if (them._contentSplit[2] != this._contentSplit[2])
                {
                    return(Comparison.different);
                }
                if (!PathEquals(them._contentSplit[3], this._contentSplit[3]))
                {
                    return(Comparison.different);
                }
                break;

            case "Module":
            case "Class":
            case "Form":
            case "UserControl":
                return(Comparison.different);

            default:
                if (them._content.Trim('"') != this._content.Trim('"'))
                {
                    return(Comparison.modified);
                }
                break;
            }
            return(Comparison.equal);
        }