示例#1
0
        //sign cli entry point
        static int Main(string[] args)
        {
            String             contextJson = args[0];
            RunTimeContext     context     = new RunTimeContext(contextJson);
            ToolManagerFactory tm          = new ToolManagerFactory("path to manifest.xml");

            //abstract AbiTool is concrete signFileTool
            AbiTool signFileTool = tm.GetTool("SignFile");

            //factory makes commands for tools
            //signFile -> sign
            //signFile -> validate
            //KW -> scan
            //KW -> upload
            //...
            AbiToolCommandFactory abiToolCmdFactory = new AbiSignFileCommandFactory(signFileTool, context.getByName("Signing"));

            //abstract command "is a" concrete sign command
            AbiCmd signCmd = abiToolCmdFactory.CreateCommand("sign");

            //abstract result "is a" sign command result
            AbiCmdResult result = signCmd.DoWork("sign target in context");

            //generate the output context from the current AbiCmdResult
            result.getContext().WriteToFile();

            //pass result return code to user
            return(result.code);
        }
示例#2
0
        public AbiTool CreateTool(string toolName, ManifestEntry manifestEntry)
        {
            AbiTool result = null;

            switch (toolName)
            {
            //gonna be a huge nasty switch block, Activator would make this simpler but reflection can make heads blow up
            case "SignFile":
                //make the generic SignFile
                result = new SignFile(this.GetToolPath(manifestEntry));
                break;

            case "SignTool":
                //make the generic SignFile
                result = new SignTool(this.GetToolPath(manifestEntry));
                break;

            default:
                throw new Exception("Unsupported tool name!");
            }
            return(result);
        }
示例#3
0
 public SignCommand(AbiTool tool, ContextObject context) : base(tool, context)
 {
     tuples = new List <Tuple <string, string> >();
 }
示例#4
0
 public AbiSignFileCommandFactory(AbiTool tool, ContextObject context) : base(tool, context)
 {
 }
示例#5
0
 public AbiCmd(AbiTool tool, ContextObject context)
 {
     this.tool    = tool;
     this.context = context;
 }
示例#6
0
 public AbiToolCommandFactory(AbiTool tool, ContextObject context)
 {
     this.tool    = tool;
     this.context = context;
 }