private string GetArgs(UpdateSettings settings) { var url = _appConfig.Get(ConfigurationTypes.Url); var storage = _appConfig.Get(ConfigurationTypes.StoragePath); var currentLocation = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); var processName = (settings.ProcessName.HasValue() ? settings.ProcessName : "Ombi"); var sb = new StringBuilder(); sb.Append($"--applicationPath \"{currentLocation}\" --processname \"{processName}\" "); //if (settings.WindowsService) //{ // sb.Append($"--windowsServiceName \"{settings.WindowsServiceName}\" "); //} var sb2 = new StringBuilder(); if (url?.Value.HasValue() ?? false) { sb2.Append($" --host {url.Value}"); } if (storage?.Value.HasValue() ?? false) { sb2.Append($" --storage {storage.Value}"); } return(sb.ToString()); }
public async Task <OneSignalNotificationResponse> PushNotification(List <string> playerIds, string message) { if (!playerIds.Any()) { return(null); } var id = await _appConfig.Get(ConfigurationTypes.Notification); var request = new Request(string.Empty, ApiUrl, HttpMethod.Post); var body = new OneSignalNotificationBody { app_id = id.Value, contents = new Contents { en = message }, include_player_ids = playerIds.ToArray() }; request.AddJsonBody(body); var result = await _api.Request <OneSignalNotificationResponse>(request); return(result); }
public async Task <OneSignalNotificationResponse> PushNotification(List <string> playerIds, string message, bool isAdminNotification, int requestId, int requestType) { if (!playerIds.Any()) { return(null); } var id = await _appConfig.Get(ConfigurationTypes.Notification); var request = new Request(string.Empty, ApiUrl, HttpMethod.Post); var body = new OneSignalNotificationBody { app_id = id.Value, contents = new Contents { en = message }, include_player_ids = playerIds.ToArray() }; if (isAdminNotification) { // Add the action buttons body.data = new { requestid = requestId, requestType = requestType }; body.buttons = new[] { new Button { id = "approve", text = "Approve Request" }, new Button { id = "deny", text = "Deny Request" }, }; } request.AddJsonBody(body); var result = await _api.Request <OneSignalNotificationResponse>(request); return(result); }