Example #1
0
 public void can_generate_assembly() {
     var c = new ExtensionsCompilerConsoleProgram();
     var result = c.Execute(new ExtensionsCompilerConsoleProgramArgs(){DllName="tmp\\ByConoleTest",Root = "",Web = false});
     Assert.NotNull(result);
     Assert.NotNull(result.GetType("ByConoleTest"));
     Assert.NotNull(result.GetType("L0_extensions_a"));
     Assert.True(result.GetType("L0_extensions_a").GetInterfaces().Contains(typeof(IRegistryLoader)));
 }
Example #2
0
        //static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        //{
        //    var dll =
        //        Directory.EnumerateFiles(root, args.Name.Split(',')[0].Trim() + ".dll",
        //                                 SearchOption.AllDirectories)
        //            .Where(x => !x.ToLower().Contains("\\extensionslib\\")).FirstOrDefault();
        //    if (dll.hasContent())
        //    {
        //        return Assembly.LoadFrom(dll);
        //    }
        //    write("no loaded "+args.Name);
        //    return null;
        //}

        protected override void execute() {
            IList<string> log = new List<string>();
            var a = new Comdiv.ConsoleUtils.ConsoleArgumentParser().Parse(CommandArgs);
            root = a.get("root","../");
            outfile = a.get("outfile");
            var isdebug = a.get("debug").toBool();
            if (isdebug) Debugger.Break();
            var exec = new ExtensionsCompilerConsoleProgram();
            exec.WriteLog = new Action<string>(s => log.Add(s));
            exec.Execute(CommandArgs);
            foreach (var l in log)
            {
                write(l);
            }
        }