コード例 #1
0
        public PayInvoicesServiceClient(PayInvoicesServiceClientSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (string.IsNullOrEmpty(settings.ServiceUrl))
            {
                throw new ArgumentException("Service URL Required");
            }

            _httpClient = new HttpClient
            {
                BaseAddress           = new Uri(settings.ServiceUrl),
                DefaultRequestHeaders =
                {
                    {
                        "User-Agent",
                        $"{PlatformServices.Default.Application.ApplicationName}/{PlatformServices.Default.Application.ApplicationVersion}"
                    }
                }
            };

            _invoiceApi = RestService.For <IInvoiceApi>(_httpClient);
            _fileApi    = RestService.For <IFileApi>(_httpClient);
            _runner     = new ApiRunner();
        }
コード例 #2
0
 public LipController(IRabbitMQHelper bus, LipHub hub)
 {
     _bus = bus;
     _hub = hub;
     //TODO: colocar na injeção de dependência
     _file = RestService.For <IFileApi>("http://file/");
 }
コード例 #3
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='fileId'>
 /// </param>
 /// <param name='lang'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> GetFileUriAsync(this IFileApi operations, string fileId, string lang, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetFileUriWithHttpMessagesAsync(fileId, lang, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
コード例 #4
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='file'>
 /// </param>
 /// <param name='lang'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> UploadFileFromOneDriveToStorageAsync(this IFileApi operations, LMSApplicationCoreCommandsOneDriveFileCommand file, string lang, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.UploadFileFromOneDriveToStorageWithHttpMessagesAsync(file, lang, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: ike709/SS14.Launcher
        private Program(string robustPath, string[] engineArgs)
        {
            _engineArgs = engineArgs;
            var zipArchive = new ZipArchive(File.OpenRead(robustPath), ZipArchiveMode.Read);

            AssemblyLoadContext.Default.Resolving             += LoadContextOnResolving;
            AssemblyLoadContext.Default.ResolvingUnmanagedDll += LoadContextOnResolvingUnmanaged;

            var prefix = "";

            if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                prefix = "Space Station 14.app/Contents/Resources/";
            }

            _fileApi = new ZipFileApi(zipArchive, prefix);
        }
コード例 #6
0
        public static async Task <HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, methods: new string[] { "GET", "POST", "OPTIONS" })] HttpRequestMessage req,
            TraceWriter log,
            [Inject(typeof(IFileApi))] IFileApi fileApi)
        {
            var httpMethods = new Dictionary <string, Func <HttpRequestMessage, TraceWriter, Task <HttpResponseMessage> > >
            {
                { "GET", async(r, l) => await fileApi.Get(r, l) },
                { "POST", async(r, l) => await fileApi.Post(r, l) }
            };

            var response = httpMethods.ContainsKey(req.Method.Method) ? await httpMethods[req.Method.Method](req, log)
                : req.CreateResponse(req.Method.Method == "OPTIONS" ? HttpStatusCode.OK : HttpStatusCode.NotFound);

            AddCORSHeader(req, response, $"GET, POST, OPTIONS");

            return(response);
        }
コード例 #7
0
 public LoaderApiLoader(IFileApi api, string prefix)
 {
     _api    = api;
     _prefix = prefix;
 }
コード例 #8
0
ファイル: MainArgs.cs プロジェクト: ike709/SS14.Launcher
 public MainArgs(string[] args, IFileApi fileApi)
 {
     Args    = args;
     FileApi = fileApi;
 }
コード例 #9
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='file'>
 /// </param>
 /// <param name='lang'>
 /// </param>
 public static object UploadFileFromOneDriveToStorage(this IFileApi operations, LMSApplicationCoreCommandsOneDriveFileCommand file, string lang)
 {
     return(operations.UploadFileFromOneDriveToStorageAsync(file, lang).GetAwaiter().GetResult());
 }
コード例 #10
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='fileId'>
 /// </param>
 /// <param name='lang'>
 /// </param>
 public static object GetFileUri(this IFileApi operations, string fileId, string lang)
 {
     return(operations.GetFileUriAsync(fileId, lang).GetAwaiter().GetResult());
 }
コード例 #11
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='filesIds'>
 /// </param>
 /// <param name='lang'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task RemoveFilesMaterialAsync(this IFileApi operations, LMSApplicationCoreCommandsRemoveFilesMaterialCommand filesIds, string lang, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.RemoveFilesMaterialWithHttpMessagesAsync(filesIds, lang, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
コード例 #12
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='filesIds'>
 /// </param>
 /// <param name='lang'>
 /// </param>
 public static void RemoveFilesMaterial(this IFileApi operations, LMSApplicationCoreCommandsRemoveFilesMaterialCommand filesIds, string lang)
 {
     operations.RemoveFilesMaterialAsync(filesIds, lang).GetAwaiter().GetResult();
 }
コード例 #13
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='lang'>
 /// </param>
 public static object GetThemeTemplate(this IFileApi operations, string lang)
 {
     return(operations.GetThemeTemplateAsync(lang).GetAwaiter().GetResult());
 }