1. C# / Говнокод #25113

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    string json = "{" +
                  "\"path\": " + EscapeForJson(path) + "," +
                  "\"cmd\": " + EscapeForJson(cmd) + "," +
                  "\"config\": {" +
                  "\"defaultPerms\": " + defaultPerms.ToString() + ", " +
                  "\"defaultCompPerms\": " + defaultCompPerms.ToString() + ", " +
                  "\"rules\": [";
    foreach (var rule in rules)
    {
        json += "{" +
                "\"path\": " + EscapeForJson(rule.path) + "," +
                "\"perms\": " + rule.perms.ToString() +
                "},";
    }
    
    if (rules.Length != 0)
    {
        json = json.Remove(json.Length - 1);  // remove last ','
    }
    json += "]}}";

    Запостил: gost, 24 Ноября 2018

    Комментарии (38) RSS

    Добавить комментарий