public static PreProcessingDirective VBToCSharp(PreProcessingDirective dir) { string cmd = dir.Cmd.ToLowerInvariant(); string arg = dir.Arg; string str3 = cmd; if (str3 != null) { if (!(str3 == "#end")) { if ((str3 == "#if") && arg.ToLowerInvariant().EndsWith(" then")) { arg = arg.Substring(0, arg.Length - 5); } } else if (arg.ToLowerInvariant().StartsWith("region")) { cmd = "#endregion"; arg = ""; } else if ("if".Equals(arg, StringComparison.InvariantCultureIgnoreCase)) { cmd = "#endif"; arg = ""; } } return new PreProcessingDirective(cmd, arg, dir.StartPosition, dir.EndPosition); }
public static PreProcessingDirective CSharpToVB(PreProcessingDirective dir) { string cmd = dir.Cmd; string arg = dir.Arg; string str3 = cmd; if (str3 != null) { if (!(str3 == "#region")) { if (str3 == "#endregion") { cmd = "#End"; arg = "Region"; } else if (str3 == "#endif") { cmd = "#End"; arg = "If"; } else if (str3 == "#if") { arg = arg + " Then"; } } else if (!arg.StartsWith("\"")) { arg = "\"" + arg.Trim() + "\""; } } if (cmd.Length > 1) { cmd = cmd.Substring(0, 2).ToUpperInvariant() + cmd.Substring(2); } return new PreProcessingDirective(cmd, arg, dir.StartPosition, dir.EndPosition); }