AXForum  
Вернуться   AXForum > Блоги > AnGor
NAV
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

Оценить эту запись

Scan the xpo-file and check the labels.

Запись от AnGor размещена 22.01.2018 в 16:19
Обновил(-а) AnGor 24.01.2018 в 10:58

Sometimes we need to check the xpo-file, if all labels are in the system.
X++:
static void Check_Labels(Args _args)
{
    str MatchLabelPattern = @"@[a-zA-Z0-9]{2,10}";
    str text;
    str curLabel;
    Label   label;
    container c;
    System.Text.RegularExpressions.Match myMatch;
    TextBuffer tb = new TextBuffer();

    tb.fromFile(@"c:\MyProject.xpo");
    text = tb.getText();
    myMatch = System.Text.RegularExpressions.Regex::Match(text, MatchLabelPattern);

    label = SysLabel::getLabelInstance(infolog.language());

    while (myMatch.get_Success())
    {
        curLabel = myMatch.get_Value();
        if(!conFind(c, curLabel) && (label.extractString(curLabel) == "" || label.exists(curLabel) == 0))
        {
            info(strFmt("Label %1 is missing",curLabel));
            c += curLabel;
        }

        myMatch = myMatch.NextMatch();
    }

    if (!conLen(c))
    {
        info("All labels are in the system");
    }
 }
It's very easy to add a button with such a function to the form SysImportDialog.
Размещено в Без категории
Просмотров 4402 Комментарии 0
Всего комментариев 0

Комментарии

 


Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 13:46.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.