void CreateFolder(IService service)
        {
            var result = new CheckFileOperationResult();
            var input  = service.GetInput <NewName>();

            switch (input.directory)
            {
            case "Dienste":
            case "drives":
                result.Result = OperationCheckResult.Incompatible;
                service.SendResult(result);
                break;

            default:
                try
                {
                    FolderCreator.Create(input);
                }
                catch (AlreadyExistsException)
                {
                    result.Result = OperationCheckResult.AlreadyExists;
                    service.SendResult(result);
                    break;
                }
                catch (UnauthorizedAccessException)
                {
                    result.Result = OperationCheckResult.Unauthorized;
                    service.SendResult(result);
                    break;
                }
                result.Result = OperationCheckResult.OK;
                service.SendResult(result);
                break;
            }
        }
Esempio n. 2
0
        public static bool Process(string[] args)
        {
            try
            {
                switch (args[0])
                {
                case "-create":
                    var path = Json.ParseBase64 <string>(args[1]);
                    FolderCreator.Create(path, true);
                    return(true);

                case "-startServices":
                    var services = Json.ParseBase64 <string[]>(args[1]);
                    ServiceStateProcessor.StartServices(services);
                    return(true);

                case "-stopServices":
                    services = Json.ParseBase64 <string[]>(args[1]);
                    ServiceStateProcessor.StopServices(services);
                    return(true);

                default:
                    return(false);
                }
            }
            catch
            {
                return(false);
            }
        }