From a796330a5053c00c2c5e3cf38bb47e21d72d349c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 15 Feb 2018 14:50:13 +0100 Subject: [PATCH] tools/compare.cs: Rename methods --- tools/compare.cs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tools/compare.cs b/tools/compare.cs index 8bd45331b..5ddb1f668 100644 --- a/tools/compare.cs +++ b/tools/compare.cs @@ -10,7 +10,7 @@ namespace difftool { class Program { - static private string firstLine(string s) + static private string FirstLine(string s) { int i = s.IndexOf('\n'); return i > 0 ? s.Substring(0, i) : s; @@ -33,20 +33,20 @@ namespace difftool ret.Add(s1[i1]); continue; } - if (firstLine(s1[i1]) == firstLine(s2[i2])) + if (FirstLine(s1[i1]) == FirstLine(s2[i2])) { ++i2; continue; } for (int i3 = i2 + 1; i3 < i2 + 300 && i3 < s2.Length; ++i3) { - if (firstLine(s1[i1]) == firstLine(s2[i3])) + if (FirstLine(s1[i1]) == FirstLine(s2[i3])) { i2 = i3; break; } } - if (firstLine(s1[i1]) == firstLine(s2[i2])) + if (FirstLine(s1[i1]) == FirstLine(s2[i2])) { ++i2; continue; @@ -56,12 +56,12 @@ namespace difftool return ret; } - static private string textToHtml(string s) + static private string TextToHtml(string s) { return s.Replace("&", "&").Replace("<", "<").Replace(">", ">"); } - static Boolean isNameChar(char c) + static Boolean IsNameChar(char c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_'; } @@ -133,7 +133,7 @@ namespace difftool "static", "const", "template", "typename", "auto", "virtual", "true", "false", "this" }; System.IO.StreamWriter file = new System.IO.StreamWriter(path + filename); - file.Write("" + textToHtml(w) + "
" + foregroundFont + textToHtml(w) + "\n");
+            file.Write("" + TextToHtml(w) + "
" + foregroundFont + TextToHtml(w) + "\n");
             int linenr = 0;
             bool multiline = false;
             foreach (string line in lines)
@@ -158,12 +158,12 @@ namespace difftool
                             if (currentToken.EndsWith("*/"))
                                 multiline = false;
                         }
-                        file.Write(multiLineCommentFont + textToHtml(currentToken) + "");
+                        file.Write(multiLineCommentFont + TextToHtml(currentToken) + "");
                     }
-                    else if (isNameChar(line[i]))
+                    else if (IsNameChar(line[i]))
                     {
                         string currentToken = "";
-                        while (i < line.Length && isNameChar(line[i]))
+                        while (i < line.Length && IsNameChar(line[i]))
                         {
                             currentToken += line[i];
                             i++;
@@ -187,11 +187,11 @@ namespace difftool
                             if (currentToken.Length > 1 && currentToken[0] == line[i - 1])
                                 break;
                         }
-                        file.Write(stringFont + textToHtml(currentToken) + "");
+                        file.Write(stringFont + TextToHtml(currentToken) + "");
                     }
                     else if (line[i] == '/' && i + 1 < line.Length && line[i + 1] == '/')
                     {
-                        file.Write(singleLineCommentFont + textToHtml(line.Substring(i)) + "");
+                        file.Write(singleLineCommentFont + TextToHtml(line.Substring(i)) + "");
                         i = line.Length;
                     }
                     else if (line[i] == '/' && i + 1 < line.Length && line[i + 1] == '*')
@@ -206,18 +206,18 @@ namespace difftool
                             if (currentToken.Length > 3 && currentToken.EndsWith("*/"))
                                 multiline = false;
                         }
-                        file.Write(multiLineCommentFont + textToHtml(currentToken) + "");
+                        file.Write(multiLineCommentFont + TextToHtml(currentToken) + "");
                     }
                     else
                     {
-                        file.Write(textToHtml(line.Substring(i, 1)));
+                        file.Write(TextToHtml(line.Substring(i, 1)));
                         i++;
                     }
                 }
                 file.Write('\n');
 
                 if (errorLine == linenr)
-                    file.Write("        " + textToHtml(w.Substring(w.IndexOf(": "))) + "\n");
+                    file.Write("        " + TextToHtml(w.Substring(w.IndexOf(": "))) + "\n");
             }
             file.Write("
"); file.Close(); @@ -303,7 +303,7 @@ namespace difftool string filename = "code" + fileIndex.ToString() + ".html"; fileIndex++; writeSourceFile(path, w, "html/" + filename); - file.WriteLine("{1}", filename, textToHtml(w)); + file.WriteLine("{1}", filename, TextToHtml(w)); } file.WriteLine("
"); }