Пример #1
0
        public override void StartModule(ICodeModuleStartInfo startInfo)
        {
            _startInfo = startInfo;

            //---------------------------------------------------------------------------------------------------------
            // You can see trace information when you pass the the trace flag on the command-line to the .NET Code Module.
            // For example: CodeClient.exe -trace:c:\temp\mylog.txt.
            // When the -trace flag is not used, then the Trace() call does nothing.
            //
            // You can use the sc.exe utility with the, config binPath= , option to modify an existing Windows service
            // command-line.
            //---------------------------------------------------------------------------------------------------------
            _startInfo.Trace("Jpeg Compression Module Started - StartModule called.");
        }
Пример #2
0
 public override void ExecuteTask(IClientTask task, IBatchContext batchContext)
 {
     try
     {
         //---------------------------------------------------------------------------------------------------------
         // Output some initial trace information about this task.
         //---------------------------------------------------------------------------------------------------------
         _startInfo.Trace("Jpeg Compression - ExecuteTask called.");
         _startInfo.Trace("Jpeg Compression - Date={0} -------------Step={1}, Batch={2}, Node={3}------------",
                          DateTime.Now.ToString(),
                          task.BatchNode.StepData.StepName,
                          task.BatchNode.NodeData.BatchName,
                          task.BatchNode.NodeData.NodeId);
         //Read the configuration values
         string TempPath    = task.BatchNode.StepData.StepConfiguration.ReadString("TempPath");
         double Compression = task.BatchNode.StepData.StepConfiguration.ReadDouble("Compression");
         _startInfo.Trace("Using Temp Storage " + TempPath);
         _startInfo.Trace("Compression Set to " + Compression.ToString());
         //First try to see at what level the module is running at
         int RootLevel = task.BatchNode.RootLevel;
         if (RootLevel == 0)
         {
             CompressNode(task.BatchNode, TempPath, Compression);
             task.CompleteTask();
         }
         else
         {
             //Loop through all of the nodes
             foreach (IBatchNode node in task.BatchNode.GetDescendantNodes(0))
             {
                 CompressNode(node, TempPath, Compression);
             }
             task.CompleteTask();
         }
     }
     catch (Exception e)
     {
         //---------------------------------------------------------------------------------------------------------
         // Trace the exception and then fail the task.
         //---------------------------------------------------------------------------------------------------------
         _startInfo.Trace("Jpeg Compression - An exception occured. {0}", e.ToString());
         if (task != null)
         {
             task.FailTask(FailTaskReasonCode.GenericUnrecoverableError, e);
         }
     }
 }
Пример #3
0
 public override void StartModule(ICodeModuleStartInfo startInfo)
 {
     startInfo.Trace("Module Started");
 }