Scan the xpo-file and check the labels.
Sometimes we need to check the xpo-file, if all labels are in the system.
It's very easy to add a button with such a function to the form SysImportDialog.
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"); } }
Всего комментариев 0