Forum syntax highlighting for C# and C++ is falling back to C (1 Viewer)

ajs

Development Group
  • Team MediaPortal
  • February 29, 2008
    15,492
    10,371
    Kyiv
    Home Country
    Ukraine Ukraine
    @high
    It does not help?
    https://xenforo.com/community/threads/geshi-syntax-highlighter.21903/#post-276543
    Change in editor_dialog_code template:
    from:
    Code:
    <option value="code=C++">C++</option>
    <option value="code=C#">C#</option>
    to
    Code:
    <option value="code=cpp">C++</option>
    <option value="code=csharp">C#</option>
    ? :whistle::coffee:

    there is no highlighting for strings
    I think they can be added. We should see the code as it is highlighted in the C and do here as well.
    https://github.com/GeSHi/geshi-1.1/tree/master/geshi/languages/csharp
     
    Last edited by a moderator:

    Vasilich

    Portal Pro
    August 30, 2009
    3,394
    1,170
    Germany, Mayence
    Home Country
    Russian Federation Russian Federation
    C#:
    using System;
    using System.IO;
    // comment
    /* more
      multiline
      comment */
    #pragma warning disable 414, 3021
    public class Program
    {
      /// <summary>The entry point to the program.</summary>
      public static int Main(string[] args)
      {
      Console.WriteLine("Hello, World!");
      string s = @"This
    ""string""
    spans
    multiple
    lines!";
      dynamic x = new ExpandoObject();
      x.MyProperty = 2; X = 0b01010001 + 44L;
      return 0xFF;
      }
    }
    async Task<int> AccessTheWebAsync()
    {
      string urlContents = await getStringTask;
      return urlContents.Length;
    }
    internal static void ExceptionFilters()
    {
      try
      {
      throw new Exception();
      }
      catch (Exception e) when (e.Message == "My error") { }
    }
    C++:
    #include <iostream>
    #define IABS(x) ((x) < 0 ? -(x) : (x))
    int main(int argc, char *argv[]) {
      /* An annoying "Hello World" example */
      for (auto i = 0; i < 0xFFFF; i++)
      cout << "Hello, World!" << endl;
      char c = '\n';
      unordered_map <string, vector<string> > m;
      m["key"] = "\\\\"; // this is an error
      return -2e3 + 12l;
    }
    fine, works
     
    Last edited:

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,492
    10,371
    Kyiv
    Home Country
    Ukraine Ukraine
    fine, works
    It is necessary to alter the string coloring for C#.

    I can not download this plugin to look like there and what works. If someone will give him, I look, at the same time highlighting washes correct.
     
    Last edited by a moderator:

    Vasilich

    Portal Pro
    August 30, 2009
    3,394
    1,170
    Germany, Mayence
    Home Country
    Russian Federation Russian Federation
    upload_2015-12-11_11-8-48.png

    so better for C#?
     

    Vasilich

    Portal Pro
    August 30, 2009
    3,394
    1,170
    Germany, Mayence
    Home Country
    Russian Federation Russian Federation
    @high can you set those strings to other themes also?
    and please replace geshi/csharp.php with attached one :)
     

    Attachments

    • csharp.zip
      3.4 KB

    Users who are viewing this thread

    Top Bottom