public ResultData Run(StepStartData data)
        {
            try
            {
                Connection            connection = CreateConnection(data);
                GoogleDriveBaseResult res        = ExecuteStep(connection, data);

                if (res.IsSucceed)
                {
                    var outputData    = OutcomeScenarios[RESULT_OUTCOME_INDEX].OutputData;
                    var exitPointName = OutcomeScenarios[RESULT_OUTCOME_INDEX].ExitPointName;

                    if (outputData != null && outputData.Length > 0)
                    {
                        return(new ResultData(exitPointName, new DataPair[] { new DataPair(outputData[0].Name, res.DataObj) }));
                    }
                    else
                    {
                        return(new ResultData(exitPointName));
                    }
                }
                else
                {
                    return(new ResultData(ERROR_OUTCOME, new DataPair[] { new DataPair(ERROR_OUTCOME_DATA_NAME, res.ErrorInfo) }));
                }
            }
            catch (Exception ex)
            {
                GoogleDriveErrorInfo ErrInfo = new GoogleDriveErrorInfo()
                {
                    ErrorMessage = ex.ToString(), HttpErrorCode = null
                };
                return(new ResultData(ERROR_OUTCOME, new DataPair[] { new DataPair(ERROR_OUTCOME_DATA_NAME, ErrInfo) }));
            }
        }
        public static GoogleDriveBaseResult DeleteResource(Connection connection, string fileOrFolderId)
        {
            CheckConnectionOrException(connection);

            FilesResource.DeleteRequest request = connection.Service.Files.Delete(fileOrFolderId);
            GoogleDriveBaseResult       result  = ExecuteRequest <FilesResource.DeleteRequest, string, GoogleDriveBaseResult>(request, null);

            return(result);
        }
        private static GoogleDriveBaseResult DownloadRequest(Google.Apis.Drive.v3.FilesResource.GetRequest request, System.IO.Stream output)
        {
            var status = request.DownloadWithStatus(output);

            if (status.Status == DownloadStatus.Completed)
            {
                return(new GoogleDriveBaseResult()
                {
                    IsSucceed = true
                });
            }
            else
            {
                var result = new GoogleDriveBaseResult();
                if (result.FillFromException(status.Exception))
                {
                    return(result);
                }
                throw status.Exception;
            }
        }
 internal GoogleDriveResultWithData(GoogleDriveBaseResult baseResult)
 {
     ErrorInfo = baseResult.ErrorInfo;
     IsSucceed = baseResult.IsSucceed;
 }