<commit_before>﻿using Mono.Cecil;
using Newtonsoft.Json;
using Serenity.Data;
using Serenity.Reflection;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace Serenity.CodeGeneration
{
    public partial class ServerTypingsGenerator : CecilImportGenerator
    {
        protected void GeneratePermissionKeys(TypeDefinition type)
        {
            GeneratePermissionKeysFor(type, declare: true);
        }

        protected void GeneratePermissionKeysFor(TypeDefinition type, bool declare)
        {
            cw.Indented(declare ? "export declare namespace ": "namespace ");
            sb.Append(type.Name);
            cw.InBrace(delegate
            {
                foreach (var fi in type.Fields.Where(x =>
                    x.IsPublic && x.IsStatic && x.HasConstant && x.Constant is string &&
                    x.DeclaringType.FullName == type.FullName &&
                    x.FieldType.FullName == "System.String"))
                {
                    cw.Indented("export const ");
                    sb.Append(fi.Name);
                    sb.Append(" = ");<commit_msg>i was wrong, declare won't work properly<commit_after>﻿using Mono.Cecil;
using Newtonsoft.Json;
using Serenity.Data;
using Serenity.Reflection;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace Serenity.CodeGeneration
{
    public partial class ServerTypingsGenerator : CecilImportGenerator
    {
        protected void GeneratePermissionKeys(TypeDefinition type)
        {
            GeneratePermissionKeysFor(type, declare: true);
        }

        protected void GeneratePermissionKeysFor(TypeDefinition type, bool declare)
        {
            cw.Indented(declare ? "export namespace ": "namespace ");
            sb.Append(type.Name);
            cw.InBrace(delegate
            {
                foreach (var fi in type.Fields.Where(x =>
                    x.IsPublic && x.IsStatic && x.HasConstant && x.Constant is string &&
                    x.DeclaringType.FullName == type.FullName &&
                    x.FieldType.FullName == "System.String"))
                {
                    cw.Indented("export const ");
                    sb.Append(fi.Name);
                    sb.Append(" = ");
{'fraction_non_alphanumeric': 0.09496043315285298, 'fraction_numerical': 0.0, 'mean_word_length': 2.1276041666666665, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1799074', 'n_tokens_mistral': 629, 'n_tokens_neox': 605, 'n_words': 137}