Example #1
0
 public ExampleCommand(
     ModuleService service,
     ResourceDescription resource,
     ModuleService newServiceSettings,
     ModuleCommandType commandType,
     int listDepth) : base(service, resource, newServiceSettings, commandType, listDepth)
 {
 }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstanceCommand"/> class.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="resource">The resource.</param>
 /// <param name="newServiceSettings">The new service settings.</param>
 /// <param name="commandType">Type of the command.</param>
 /// <param name="listDepth">The list depth.</param>
 public FoldersCommand(ModuleService service, ResourceDescription resource, ModuleService newServiceSettings, ModuleCommandType commandType, int listDepth)
     : base(service, resource, newServiceSettings, commandType, listDepth)
 {
     this.resource = resource;
     this.service = service;
     this.newServiceSettings = newServiceSettings;
     this.commandType = commandType;
     this.listDepth = listDepth;
 }
 public ExampleCommandBase(
     ModuleService service,
     ResourceDescription resource,
     ModuleService newServiceSettings,
     ModuleCommandType commandType,
     int listDepth) : base(service, resource, newServiceSettings, commandType, listDepth)
 {
     if (service.Properties.SingleOrDefault(p => p.Name == "AccountId") != null)
     {
         AccountId = service["AccountId"];
         FirstName = service["FirstName"];
         LastName  = service["LastName"];
     }
 }
 public HaproxyCommandBase(ModuleService service, ResourceDescription resource, ModuleService newServiceSettings, ModuleCommandType commandType, int listDepth)
     : base(service, resource, newServiceSettings, commandType, listDepth)
 {
     this.jsonSerializer = new JavaScriptSerializer();
 }
 public ListenerSettingCommand(ModuleService service, ResourceDescription resource, ModuleService newServiceSettings, ModuleCommandType commandType, int listDepth)
     : base(service, resource, newServiceSettings, commandType, listDepth)
 {
 }
Example #6
0
 public FileCommand(ModuleService service, ResourceDescription resource, ModuleService newServiceSettings, ModuleCommandType commandType, int listDepth, string transContext)
     : base(service, resource, newServiceSettings, commandType, listDepth)
 {
     this.transContext = transContext;
 }
Example #7
0
        /// <summary>
        /// Prepares the command list.
        /// </summary>
        /// <param name="service">Service to populate.</param>
        /// <param name="newServiceSettings">New service settings.</param>
        /// <param name="resource">Server resource.</param>
        /// <param name="commandType">Type of command.</param>
        private void PrepareCommandList(ModuleService service, ModuleService newServiceSettings, ResourceDescription resource, ModuleCommandType commandType)
        {
            if (commandType != ModuleCommandType.Remove)
            {
                this.commands.Add(this.GetModuleCommand(resource, commandType, -1, service, newServiceSettings));
            }

            if (service.Children != null)
            {
                for (int i = 0; i < service.Children.Count; i++)
                {
                    ModuleService childService = service.Children[i];
                    ModuleService newChildSettings = null;
                    if (newServiceSettings != null && newServiceSettings.Children != null && newServiceSettings.Children.Count > i)
                    {
                        newChildSettings = newServiceSettings.Children[i];
                    }

                    this.PrepareCommandList(childService, newChildSettings, resource, commandType);
                }
            }

            if (commandType == ModuleCommandType.Remove)
            {
                this.commands.Add(this.GetModuleCommand(resource, commandType, -1, service, newServiceSettings));
            }
        }
Example #8
0
        /// <summary>
        /// Gets the module command.
        /// </summary>
        /// <param name="resource">The server resource.</param>
        /// <param name="commandType">Type of the command.</param>
        /// <param name="childService">The child service.</param>
        /// <returns>Module command</returns>
        private ModuleCommand GetModuleCommand(ResourceDescription resource, ModuleCommandType commandType, int listDepth, params ModuleService[] childService)
        {
            ModuleCommand command = null;
            string serviceName = childService[0].Name;

            Type command_type = null;

            switch (serviceName)
            {
                case "Folders":
                    {
                        command_type = typeof(Commands.FoldersCommand);
                    }
                    break;
                case "OtherCommand":
                    {
                        //command_type = typeof(Commands.OtherCommand);
                    }
                    break;
            }

            command = (ModuleCommand)Activator.CreateInstance(command_type, new object[] { childService[0], resource, commandType == ModuleCommandType.Modify ? childService[1] : null, commandType, listDepth });

            return command;
        }