public static Tableboard ImportSetting(string path) { var serviceImport = new FileImportController(); var fileResult = serviceImport.ImportSetting(path); if (fileResult.Success) { var serviceValidation = new BoardValidationController(); var validationResult = serviceValidation.ValidateBoard(fileResult.Result); if (validationResult.Success) { return(fileResult.Result); } else { var boardRageText = $" ({validationResult.MinWidth},{validationResult.MaxWidth})"; var maxX = Math.Max(0, Math.Min(validationResult.MaxWidth, fileResult.Result.Size.Width - 1)); var maxY = Math.Max(0, Math.Min(validationResult.MaxWidth, fileResult.Result.Size.Height - 1)); var maxPointBoardText = $"({maxX},{maxY})"; var listMessage = validationResult.Result .Select(r => GetErrorBoardMessages(r, boardRageText, maxPointBoardText)) .ToList(); throw new ListMessageException(listMessage); } } else { throw new MessageException(GetErrorFileMessages(fileResult.ErrorType, SETTING_FILE_TYPE)); } }
public static List <TurtleActionType> ImportActions(string path) { var serviceImport = new FileImportController(); var fileResult = serviceImport.ImportActions(path); if (fileResult.Success) { return(fileResult.Result); } else { throw new MessageException(GetErrorFileMessages(fileResult.ErrorType, ACTIONS_FILE_TYPE)); } }