Esempio n. 1
0
        private void ProcessIncludedFiles(Command command)
        {
            if (command is IContainerCommand)
            {
                IContainerCommand iContainer = (IContainerCommand)command;
                if (iContainer.InnerCommands == null)
                {
                    return;
                }
                foreach (Command cmd in iContainer.InnerCommands)
                {
                    ProcessIncludedFiles(cmd);
                }
            }

            if (command is IContentCommand)
            {
                IContentCommand cntCommand     = (IContentCommand)command;
                string          sourceFilePath = cntCommand.ContentPath;
                if (sourceFilePath == null)
                {
                    return;
                }
                if (sourceFilePath.Contains(ExecutionContext.PACKAGE_CONTENT_TAG) ||
                    sourceFilePath.Contains(ExecutionContext.GIN_EXE_TAG))
                {
                    return;
                }
                cntCommand.ContentPath = _content.AddContent(sourceFilePath);
            }
            if (command is IMultipleContentCommand)
            {
                IMultipleContentCommand cntCommand = (IMultipleContentCommand)command;
                if (cntCommand.ContentPaths != null)
                {
                    foreach (ContentPath p in cntCommand.ContentPaths)
                    {
                        string sourceFilePath = p.Value;
                        if (sourceFilePath == null)
                        {
                            return;
                        }
                        if (sourceFilePath.Contains(ExecutionContext.PACKAGE_CONTENT_TAG) ||
                            sourceFilePath.Contains(ExecutionContext.GIN_EXE_TAG))
                        {
                            return;
                        }
                        p.Value = _content.AddContent(sourceFilePath);
                    }
                }
            }
        }
Esempio n. 2
0
 private void CheckPackageSourceNeeds(Command command)
 {
     if (command is IContentCommand)
     {
         IContentCommand iCont = (IContentCommand)command;
         if (iCont.ContentPath != null && iCont.ContentPath.StartsWith(ExecutionContext.PACKAGE_SOURCE_TAG))
         {
             if (!_containsPackageSource && String.IsNullOrEmpty(_body.IncludedPath))
             {
                 _errors.Add(new PackageErrorInfo
                 {
                     Body        = _body,
                     Command     = null,
                     Description =
                         "В пакете используется доступ по относительным путям %PACKAGE_SOURCE%. Необходимо указать для пакета путь к исходным файлам, включаемым в пакет."
                 });
                 _containsPackageSource = true;
             }
             else
             {
                 CheckFilePresent(command);
             }
         }
     }
     if (command is IMultipleContentCommand)
     {
         IMultipleContentCommand iCont = (IMultipleContentCommand)command;
         foreach (ContentPath p in iCont.ContentPaths)
         {
             if (p.Value != null && p.Value.StartsWith(ExecutionContext.PACKAGE_SOURCE_TAG))
             {
                 if (!_containsPackageSource && String.IsNullOrEmpty(_body.IncludedPath))
                 {
                     _errors.Add(new PackageErrorInfo
                     {
                         Body        = _body,
                         Command     = null,
                         Description =
                             "В пакете используется доступ по относительным путям %PACKAGE_SOURCE%. Необходимо указать для пакета путь к исходным файлам, включаемым в пакет."
                     });
                     _containsPackageSource = true;
                 }
                 else
                 {
                     CheckFilePresent(command);
                 }
             }
         }
     }
 }