Пример #1
0
 public static void AddCodeImport(List <KeywordUsage> keywordUsages, string codeBlock)
 {
     keywordUsages.Add(new KeywordUsage(Glossary.Macros[FunctionKeyword.CODE_IMPORT], codeBlock)
     {
         arguments      = 1,
         onFeedCodeFile = (fileData, codeFile, codeInfos, arguments, data) =>
         {
             var sourcePath = Path.Combine(fileData.source.directory, arguments[0].Content);
             if (File.Exists(sourcePath))
             {
                 var fileBody = File.ReadAllText(sourcePath);
                 fileBody     = fileBody.CleanText();
                 fileBody     = CodeFile.CleanPrateekComments(fileBody);
                 codeFile.ScriptContent.SetFileBody(fileBody);
                 return(true);
             }
             return(false);
         }
     });
 }