_Samples/Example_Automation.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Data;
using System.Data.Common;
using System.Security.Cryptography;
using System.Security.Principal;

//<doc:using>
using ComLib;
using ComLib.Automation;
//<doc:using>
using ComLib.Application;


namespace ComLib.Samples
{
    /// <summary>
    /// Example for the automation component.
    /// </summary>
    public class Example_Automation : App
    {
        /// <summary>
        /// Execute the sample
        /// </summary>
        /// <returns></returns>
        public override BoolMessageItem Execute()
        {
            string sampleScript =
@"<automation>	
	<!-- Variables -->
	<var name=""first""   value=""kishore"" />
	<var name=""last""    value=""reddy"" />
    <var name=""version"" value=""0.9.7"" />
	
	<!-- commands -->
	<command name=""helloworld"" email=""${first}.${last}@mysite.com"" subject=""CommonLibrary.NET ${version} is out"" />
</automation>";


            // create script runner and tell it to run xml scripts, and to load
            // the commands from the CommonLibrary.dll which
            // only has one command ( bottom of this file "CommandHelloWorld" ).
            var runner = new AutomationRunner("xml", "Commonlibrary");
            
            // 1. Xml automation script
            var results = runner.RunText(sampleScript);
            runner.WriteResultsToFile("c:/temp/automation.xml");

            // 2. Command Line style automation script
            runner.Init("cmd", "CommonLibrary");
            runner.RunText(@"helloword email=""kishore@c.com"" subject=""comlib automation component""");
            return new BoolMessageItem(null, true, string.Empty);
        }
    }


    
后面还有 20 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。