Beispiel #1
0
 public void PublishingOptionsConvertsFileToAssembly()
 {
     var c = new TestsCompiler()
       .StoreAssemblyAs("PublishingOptionsConvertsFileToAssembly.dll")
       .With<AssemblyWithSingleDownload>();
     var options = new PublishingOptions { PathToAssembly = "PublishingOptionsConvertsFileToAssembly.dll" };
     var ass = options.EntryAssembly;
     ass.ShouldNotBeNull();
 }
Beispiel #2
0
        /// <summary>
        /// Call with an assembly already available
        /// </summary>
        public Publisher(PublishingOptions options)
        {
            if (!options.RunInSeparateAppDomain)
              {
            var p = new PublishProcess();
            p.SetData(options);
            p.Start();
            return;
              }

              var exp = new AppDomainExpander<PublishProcess>();
              var setup = new AppDomainSetup { ApplicationBase = Environment.CurrentDirectory };
              exp.Create(setup, options);
              exp.End();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            var showHelp = false;
              var setup = new PublishingOptions();

              var options =
            new OptionSet
              {
            {"t|torrentname=", "The name the torrent file should get. By default this is the title provided by the entry assembly", v => setup.TorrentName = v},
            {"a|assembly=", "path to the assembly that is the entry point", v=> setup.PathToAssembly = v},
            {"s|separate", "assembly loading will be done in a separate appdomain that is unloaded when the publisher finishes", v=> setup.RunInSeparateAppDomain = true},
            {"c|content=", "File or directory that constitutes the content of the download", v=> setup.Content = v},
            {"h|help", "Shows the usage help", v => showHelp = true}
              };
              try
              {
            options.Parse(args);

            if (showHelp)
            {
              options.WriteOptionDescriptions(Console.Out);
              goto end;
            }
            setup.Validate();
            //using (var runner = new BuildRunner(setup))
            //  runner.Run();
              }
              catch (OptionException x)
              {
            Console.WriteLine("The options to the publisher were not understood: {0}", x.Message);
            options.WriteOptionDescriptions(Console.Out);
              }
              catch (ArgumentException x)
              {
            Console.WriteLine("Publisher has isues with the options: {0}", x.Message);
              }
              end: Console.WriteLine("Publisher finished.");
        }