コード例 #1
0
        /// <summary>
        /// When implemented in a derived class, performs the execution of the activity.
        /// </summary>
        /// <param name="context">The execution context under which the activity executes.</param>
        protected override void Execute(CodeActivityContext context)
        {
            var attributeName              = AttributeName.Get(context);
            var attributeValue             = AttributeValue.Get(context);
            var createAttributeIfNotExists = CreateAttributeIfNotExists.Get(context);
            var directoryToSearch          = DirectoryToSearch.Get(context);
            var fileNamesToSearch          = FileNamesToSearch.Get(context);
            var commandLog = new CodeActivityContextCommandLog(context);
            var recursive  = Recursive.Get(context);
            var writeVerboseLogMessages = WriteVerboseLogMessages.Get(context);

            var command =
                new SetAssemblyAttributeInFilesCommand
            {
                AttributeName              = attributeName,
                AttributeValue             = attributeValue,
                CreateAttributeIfNotExists = createAttributeIfNotExists,
                DirectoryToSearch          = directoryToSearch,
                FileNamesToSearch          = fileNamesToSearch,
                CommandLog = commandLog,
                Recursive  = recursive,
                WriteVerboseLogMessages = writeVerboseLogMessages
            };

            var successful = command.Execute();

            if (false == successful)
            {
                commandLog.Error("The SetAssemblyAttributeInFiles activity failed.");
            }
        }
コード例 #2
0
ファイル: CombineXPOs.cs プロジェクト: dax516/DynamicsAXAdmin
        protected override void Execute(CodeActivityContext context)
        {
            string folder                  = Folder.Get(context);
            bool   recursive               = Recursive.Get(context);
            string combinedXPOFile         = CombinedXPOFile.Get(context);
            bool   includeSystemObjects    = IncludeSystemObjects.Get(context);
            bool   includeNonSystemObjects = IncludeNonSystemObjects.Get(context);

            if (!System.IO.Directory.Exists(System.IO.Path.GetDirectoryName(combinedXPOFile)))
            {
                System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(combinedXPOFile));
            }

            if (includeNonSystemObjects && includeSystemObjects)
            {
                CodeCrib.AX.Client.CombineXPOs.Combine(folder, recursive, combinedXPOFile, Client.CombineXPOs.IncludeObjects.AllObjects);
            }
            else if (includeNonSystemObjects && !includeSystemObjects)
            {
                CodeCrib.AX.Client.CombineXPOs.Combine(folder, recursive, combinedXPOFile, Client.CombineXPOs.IncludeObjects.ExcludeSystemObjects);
            }
            else if (!includeNonSystemObjects && includeSystemObjects)
            {
                CodeCrib.AX.Client.CombineXPOs.Combine(folder, recursive, combinedXPOFile, Client.CombineXPOs.IncludeObjects.SystemObjectsOnly);
            }
            // else neither
        }
        /// <summary>
        /// When implemented in a derived class, performs the execution of the activity.
        /// </summary>
        /// <param name="context">The execution context under which the activity executes.</param>
        protected override void Execute(CodeActivityContext context)
        {
            var accessedDate            = AccessedDate.Get(context);
            var createdDate             = CreatedDate.Get(context);
            var modifiedDate            = ModifiedDate.Get(context);
            var directoryToSearch       = DirectoryToSearch.Get(context);
            var fileNamesToSearch       = FileNamesToSearch.Get(context);
            var commandLog              = new CodeActivityContextCommandLog(context);
            var recursive               = Recursive.Get(context);
            var setAccessedDate         = SetAccessedDate.Get(context);
            var setCreatedDate          = SetCreatedDate.Get(context);
            var setModifiedDate         = SetModifiedDate.Get(context);
            var writeVerboseLogMessages = WriteVerboseLogMessages.Get(context);

            var command =
                new SetFilesystemDateAttributesInFilesCommand
            {
                AccessedDate            = accessedDate,
                CreatedDate             = createdDate,
                ModifiedDate            = modifiedDate,
                DirectoryToSearch       = directoryToSearch,
                FileNamesToSearch       = fileNamesToSearch,
                CommandLog              = commandLog,
                Recursive               = recursive,
                SetAccessedDate         = setAccessedDate,
                SetCreatedDate          = setCreatedDate,
                SetModifiedDate         = setModifiedDate,
                WriteVerboseLogMessages = writeVerboseLogMessages
            };

            var successful = command.Execute();

            if (false == successful)
            {
                commandLog.Error("The SetFilesystemDateAttributesInFiles activity failed.");
            }
        }