Example #1
0
 public Create(IEnvironmentDetails environmentDetails, IRestClient client) : base(environmentDetails, client, "Creates a new torrent from a file source.")
 {
     HasRequiredOption("n|name=", "Name of the torrent to be created.", o => Name = o);
     HasRequiredOption("s|sourceDirectory=", "Source directory for torrent.", o => SourceDirectory = o);
     HasOption("trackers=", "Trackers to add to the torrent. Comma seperation for more than one.", o => Trackers = o.Split(','));
     HasOption("a|add", "Adds the torrent after it has been created.", o => Add = o != null);
 }
Example #2
0
 public Add(IEnvironmentDetails environmentDetails, IRestClient client) : base(environmentDetails, client, "Adds a torrent to be deployed.")
 {
     HasRequiredOption("t|torrent=", "Torrent deployment file path.", o => TorrentPath = o);
     HasRequiredOption("o|outputDirectory=", "Output directory path for deployment.", o => OuputDirectoryPath = o);
     HasOption("m|mirror", "Walks the output directory to make sure it mirrors the deployment. Any additional files will be deleted.", o => Mirror = o != null);
     HasOption("w|wait", "Wait for deployment to finish downloading before exiting.", o => Wait = o != null);
 }
Example #3
0
File: Add.cs Project: kl4w/BTDeploy
 public Add(IEnvironmentDetails environmentDetails, IRestClient client)
     : base(environmentDetails, client, "Adds a torrent to be deployed.")
 {
     HasRequiredOption ("t|torrent=", "Torrent deployment file path.", o => TorrentPath = o);
     HasRequiredOption ("o|outputDirectory=", "Output directory path for deployment.", o => OuputDirectoryPath = o);
     HasOption ("m|mirror", "Walks the output directory to make sure it mirrors the deployment. Any additional files will be deleted.", o => Mirror = o != null);
     HasOption ("w|wait", "Wait for deployment to finish downloading before exiting.", o => Wait = o != null);
 }
Example #4
0
 public Create(IEnvironmentDetails environmentDetails, IRestClient client)
     : base(environmentDetails, client, "Creates a new torrent from a file source.")
 {
     HasRequiredOption ("n|name=", "Name of the torrent to be created.", o => Name = o);
     HasRequiredOption ("s|sourceDirectory=", "Source directory for torrent.", o => SourceDirectory = o);
     HasOption ("trackers=", "Trackers to add to the torrent. Comma seperation for more than one.", o => Trackers = o.Split (','));
     HasOption ("a|add", "Adds the torrent after it has been created.", o => Add = o != null);
 }
Example #5
0
        public ServicesAppHost(IEnvironmentDetails environmentDetails, ITorrentClient torrentClient) : base(Assembly.GetExecutingAssembly().FullName, typeof(ServicesAppHost).Assembly)
        {
            // Set the torrent client.
            TorrentClient = torrentClient;

            // Ask OS for port and make the endpoint.
            Endpoint = string.Format("http://*:{0}/", environmentDetails.ServiceDaemonPort);
        }
Example #6
0
        public ServicesAppHost(IEnvironmentDetails environmentDetails, ITorrentClient torrentClient)
            : base(Assembly.GetExecutingAssembly().FullName, typeof (ServicesAppHost).Assembly)
        {
            // Set the torrent client.
            TorrentClient = torrentClient;

            // Ask OS for port and make the endpoint.
            Endpoint = string.Format ("http://*:{0}/", environmentDetails.ServiceDaemonPort);
        }
Example #7
0
        public Admin(IEnvironmentDetails environmentDetails, IRestClient client)
        {
            IsCommand ("Admin", "Basic administration commands.");
            HasOption ("start", "Spawns the long lasting background daemon. This process contines downloading and/or seeding after the application has exited.", o => Start = o != null);
            HasOption ("stop", "Terminates the long lasting background daemon, this process would otherwise continuing downloading and/or seeding after the application has exited.", o => Stop = o != null);
            SkipsCommandSummaryBeforeRunning ();

            Client = client;
            EnvironmentDetails = environmentDetails;
        }
Example #8
0
        public Admin(IEnvironmentDetails environmentDetails, IRestClient client)
        {
            IsCommand("Admin", "Basic administration commands.");
            HasOption("start", "Spawns the long lasting background daemon. This process contines downloading and/or seeding after the application has exited.", o => Start = o != null);
            HasOption("stop", "Terminates the long lasting background daemon, this process would otherwise continuing downloading and/or seeding after the application has exited.", o => Stop = o != null);
            SkipsCommandSummaryBeforeRunning();

            Client             = client;
            EnvironmentDetails = environmentDetails;
        }
        public GeneralConsoleCommandBase(IEnvironmentDetails environmentDetails, IRestClient client, string oneLineDescription)
        {
            // Set the base commands.
            IsCommand(this.GetType().Name, oneLineDescription);
            HasOption("noStart", "Prevents the long lasting process from being spawned automatically", o => Start = o == null);
            HasOption("noStop", "Prevents the long lasting background daemon from being killed, this process will continue downloading and/or seeding after the application has exited.", o => Kill = o == null);
            SkipsCommandSummaryBeforeRunning();

            // Set common items.
            EnvironmentDetails = environmentDetails;
            Client             = client;
        }
        public GeneralConsoleCommandBase(IEnvironmentDetails environmentDetails, IRestClient client, string oneLineDescription)
        {
            // Set the base commands.
            IsCommand (this.GetType ().Name, oneLineDescription);
            HasOption ("noStart", "Prevents the long lasting process from being spawned automatically", o => Start = o == null);
            HasOption ("noStop", "Prevents the long lasting background daemon from being killed, this process will continue downloading and/or seeding after the application has exited.", o => Kill = o == null);
            SkipsCommandSummaryBeforeRunning ();

            // Set common items.
            EnvironmentDetails = environmentDetails;
            Client = client;
        }
Example #11
0
        protected static void RunServiceDaemon(IEnvironmentDetails environmentDetails)
        {
            // Make the torrent client.
            var monotTorrentClient = new MonoTorrentClient (environmentDetails.ApplicationDataDirectoryPath);
            monotTorrentClient.Start ();

            // Make torrent service app host.
            var servicesAppHost = new ServicesAppHost (environmentDetails, monotTorrentClient);
            servicesAppHost.Init ();

            // Never die.
            Thread.Sleep (Timeout.Infinite);
        }
Example #12
0
        protected static void RunServiceDaemon(IEnvironmentDetails environmentDetails)
        {
            // Make the torrent client.
            var monotTorrentClient = new MonoTorrentClient(environmentDetails.ApplicationDataDirectoryPath);

            monotTorrentClient.Start();

            // Make torrent service app host.
            var servicesAppHost = new ServicesAppHost(environmentDetails, monotTorrentClient);

            servicesAppHost.Init();

            // Never die.
            Thread.Sleep(Timeout.Infinite);
        }
Example #13
0
        public static void RunClientCommand(IEnvironmentDetails environmentDetails, string[] args)
        {
            // Make the container.
            var containerBuilder = new ContainerBuilder();
            containerBuilder.RegisterAssemblyTypes (typeof(Program).Assembly)
                    .Where (t => t.IsAssignableTo<ConsoleCommand> ())
                    .As<ConsoleCommand> ()
                    .OwnedByLifetimeScope();
            containerBuilder.RegisterType<EnvironmentDetails> ()
                    .AsImplementedInterfaces ()
                    .OwnedByLifetimeScope ();
            containerBuilder.RegisterType<JsonServiceClient> ()
                    .WithParameter (new NamedParameter ("baseUri", environmentDetails.ServiceDaemonEndpoint))
                    .WithProperty ("Timeout", new TimeSpan (0, 10, 0))
                    .AsImplementedInterfaces ()
                    .OwnedByLifetimeScope ();
            var container = containerBuilder.Build ();

            // Get the commands and run them.
            var commands = container.Resolve<IEnumerable<ConsoleCommand>> ().OrderBy (c => c.Command);
            ConsoleCommandDispatcher.DispatchCommand (commands, args, Console.Out);
        }
Example #14
0
        public static void RunClientCommand(IEnvironmentDetails environmentDetails, string[] args)
        {
            // Make the container.
            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterAssemblyTypes(typeof(Program).Assembly)
            .Where(t => t.IsAssignableTo <ConsoleCommand> ())
            .As <ConsoleCommand> ()
            .OwnedByLifetimeScope();
            containerBuilder.RegisterType <EnvironmentDetails> ()
            .AsImplementedInterfaces()
            .OwnedByLifetimeScope();
            containerBuilder.RegisterType <JsonServiceClient> ()
            .WithParameter(new NamedParameter("baseUri", environmentDetails.ServiceDaemonEndpoint))
            .WithProperty("Timeout", new TimeSpan(0, 10, 0))
            .AsImplementedInterfaces()
            .OwnedByLifetimeScope();
            var container = containerBuilder.Build();

            // Get the commands and run them.
            var commands = container.Resolve <IEnumerable <ConsoleCommand> > ().OrderBy(c => c.Command);

            ConsoleCommandDispatcher.DispatchCommand(commands, args, Console.Out);
        }
Example #15
0
 public Remove(IEnvironmentDetails environmentDetails, IRestClient client)
     : base(environmentDetails, client, "Removes specified deployments. Specify deployments by providing torrent id or wildcard name pattern.")
 {
     HasOption ("d|delete", "Deletes the files along with the torrent deployment file.", o => Delete = o != null);
     HasAdditionalArguments (null);
 }
Example #16
0
 public Remove(IEnvironmentDetails environmentDetails, IRestClient client) : base(environmentDetails, client, "Removes specified deployments. Specify deployments by providing torrent id or wildcard name pattern.")
 {
     HasOption("d|delete", "Deletes the files along with the torrent deployment file.", o => Delete = o != null);
     HasAdditionalArguments(null);
 }
Example #17
0
 public List(IEnvironmentDetails environmentDetails, IRestClient client)
     : base(environmentDetails, client, "Lists the current deployments. Filter deployments by providing torrent id or wildcard name pattern.")
 {
     HasOption ("id", "Include torrent id in output table.", o => IncludeId = o != null);
     HasAdditionalArguments (null);
 }
Example #18
0
 public Wait(IEnvironmentDetails environmentDetails, IRestClient client) : base(environmentDetails, client, "Waits until specified deployments finishes downloading before exiting. Specify deployments by providing torrent id or wildcard name pattern.")
 {
     HasAdditionalArguments(null);
 }
Example #19
0
 public Wait(IEnvironmentDetails environmentDetails, IRestClient client)
     : base(environmentDetails, client, "Waits until specified deployments finishes downloading before exiting. Specify deployments by providing torrent id or wildcard name pattern.")
 {
     HasAdditionalArguments (null);
 }
Example #20
0
 public List(IEnvironmentDetails environmentDetails, IRestClient client) : base(environmentDetails, client, "Lists the current deployments. Filter deployments by providing torrent id or wildcard name pattern.")
 {
     HasOption("id", "Include torrent id in output table.", o => IncludeId = o != null);
     HasAdditionalArguments(null);
 }