Example #1
0
        void removeBindings(string path)
        {
            string oldFileContents = _disk.ReadAllText(path);
            string newFileContents = oldFileContents;

            //-- remove any GlobalSection(SourceCodeControl) block
            newFileContents = Regex.Replace(
                newFileContents, "\\s+GlobalSection\\(SourceCodeControl\\)[\\w|\\W]+?EndGlobalSection", string.Empty);

            //-- remove TFS stuff
            newFileContents = Regex.Replace(
                newFileContents, "\\s+GlobalSection\\(TeamFoundationVersionControl\\)[\\w|\\W]+?EndGlobalSection", string.Empty);

            //-- remove any remaining lines that have keys beginning with 'Scc'
            newFileContents = Regex.Replace(
                newFileContents, @"^\s+Scc.*[\n\r\f]",
                string.Empty,
                RegexOptions.Multiline);

            //-- remove any remaining lines that have xml elements beginning with 'Scc'
            newFileContents = Regex.Replace(
                newFileContents, @"^\s+<Scc.*[\n\r\f]",
                string.Empty,
                RegexOptions.Multiline);

            if (newFileContents != oldFileContents)
            {
                _disk.WriteTextToFile(path, newFileContents);
            }
        }