Example #1
0
        public ContainerForCommand ParseCommand(string input)
        {
            ContainerForCommand command = null;

            try
            {
                var vs = input.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);

                if (!vs.Any())
                {
                    throw new ParsingException("Parsed string does not contain any element");
                }

                var textCommand = vs[0];
                var fromPath    = vs.Length > 1 ? vs[1] : string.Empty;
                var toPath      = vs.Length > 2 ? vs[2] : string.Empty;

                if (Enum.TryParse(textCommand, out FileOperation fileOperation))
                {
                    command = new ContainerForCommand(fileOperation, fromPath, toPath);
                }

                if (command is null)
                {
                    throw new CommandException("The command is wrong");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(command);
        }
Example #2
0
 public MetaFileStorageService(ContainerForCommand containerForCommand,
                               MetaFileInfoSettings metaFileInfoSettings,
                               IMetaFileInfoSerializerService metaFileInfoSerializerService,
                               IAuthenticationService authenticationService
                               )
     : base(containerForCommand, metaFileInfoSettings)
 {
     _metaFileInfoSerializerService = metaFileInfoSerializerService;
     _authenticationService         = authenticationService;
 }
 public FileStorageService(ContainerForCommand containerForCommand, MetaFileInfoSettings metaFileInfoSettings) : base(containerForCommand, metaFileInfoSettings)
 {
 }
 public BaseStorageService(ContainerForCommand containerForCommand, MetaFileInfoSettings metaFileInfoSettings)
 {
     ContainerForCommand  = containerForCommand;
     MetaFileInfoSettings = metaFileInfoSettings;
 }